You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sqlacodegen seems to work fine with ENUM types; SETs are a different story.
If you attempt to run on a database with a SET column type, such as the following:
CREATETABLE `tools_datasets` (
`tool_id`int(11) NOT NULL,
`dataset_id`int(11) NOT NULL,
`status`SET('p','i','e') DEFAULT 'i,e',
PRIMARY KEY (`tool_id`,`dataset_id`),
);
you'll get an error like this:
$ flask-sqlacodegen --version
1.1.6.1
$ flask-sqlacodegen --tables tools_datasets $DBCONN
Traceback (most recent call last):
File "/Users/user/path/to/project/venv/bin/flask-sqlacodegen", line 11, in <module>
sys.exit(main())
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlacodegen/main.py", line 59, in main
args.flask, ignore_cols, args.noclasses)
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlacodegen/codegen.py", line 606, in __init__
model = ModelClass(table, links[table.name], inflect_engine, not nojoined)
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlacodegen/codegen.py", line 309, in __init__
super(ModelClass, self).__init__(table)
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlacodegen/codegen.py", line 248, in __init__
column.type = column.type.adapt(cls)
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/enumerated.py", line 310, in adapt
**kw
File "/Users/user/path/to/project/venv/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 1045, in constructor_copy
return cls(*args, **kw)
TypeError: __init__() got an unexpected keyword argument 'retrieve_as_bitwise'
I know that the SET column type is kind of out in the weeds (maybe it's better to just use a many-to-many relationship), but honestly, is ENUM is kind of in that category, too , so maybe we could work to support SET as well.
The text was updated successfully, but these errors were encountered:
sqlacodegen
seems to work fine withENUM
types;SET
s are a different story.If you attempt to run on a database with a
SET
column type, such as the following:you'll get an error like this:
I know that the
SET
column type is kind of out in the weeds (maybe it's better to just use a many-to-many relationship), but honestly, isENUM
is kind of in that category, too , so maybe we could work to supportSET
as well.The text was updated successfully, but these errors were encountered: