- attached check-bug.py
Enum generates invalid CHECK statements in DDL
Issue #1883
resolved
The attached script throws this error:
Use CONNECT or CREATE DATABASE to specify a database
Traceback (most recent call last):
File "x.py", line 24, in <module>
A.__table__.create(bind=engine)
:
:
File "/usr/lib/python2.6/dist-packages/sqlalchemy/dialects/firebird/base.py", line 679, in do_execute
cursor.execute(statement, parameters or [])
sqlalchemy.exc.ProgrammingError: (ProgrammingError) (-104, 'isc_dsql_prepare: \n Dynamic SQL Error\n SQL error code = -104\n Token unknown - line 5, column 19\n ,') "\nCREATE TABLE a (\n\tc VARCHAR(1) NOT NULL, \n\tPRIMARY KEY (c), \n\tCHECK (c IN (('x',)))\n)\n\n" ()
The DDL, which the script writes to "ddl.log" that causes the error is this:
CREATE TABLE a (
c VARCHAR(1) NOT NULL,
PRIMARY KEY (c),
CHECK (c IN (('x',)))
)
It is the CHECK statement that causes the problem. I think it should be:
CHECK (c IN ('x',))
Firebird agrees - it happily accepts the above syntax.
PS: You may have to edit and put in a firebird user/password suitable for your firebird installation.
Comments (2)
-
Account Deleted -
repo owner Enum accepts positional *args: http://www.sqlalchemy.org/docs/reference/sqlalchemy/types.html?highlight=enum#sqlalchemy.types.Enum
- Log in to comment
Script that demonstrates the bug