omymodels icon indicating copy to clipboard operation
omymodels copied to clipboard

Unable to run generating SQLModel PostgreSQL Arrays

Open RyPeck opened this issue 1 year ago • 1 comments

Describe the bug omymodels unable to generate SQLModel code with Arrays.

To Reproduce Steps to reproduce the behavior:

Run

from omymodels import create_models


ddl = """
CREATE TABLE test_table (
    id SERIAL PRIMARY KEY,
    names TEXT[]
);
"""

result = create_models(ddl, models_type='sqlmodel')['code']

print(result)

Will receive the following error -

TypeError: string indices must be integers, not 'str'

Expected behavior

SQLModel code generates without errors.

Desktop (please complete the following information):

  • OS: MacOS
  • Version [e.g. 22]

RyPeck avatar Jan 13 '25 22:01 RyPeck

cc @cfhowes

RyPeck avatar Jan 13 '25 22:01 RyPeck