Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Firebird SQL as a database driver #5

Open
jadkik opened this issue Jan 21, 2014 · 0 comments
Open

Support for Firebird SQL as a database driver #5

jadkik opened this issue Jan 21, 2014 · 0 comments
Assignees

Comments

@jadkik
Copy link
Member

jadkik commented Jan 21, 2014

Support for Firebird SQL is currently lacking, primarily because of the auto_increment of all ID fields on the models. Firebird has no such thing as autoincrement fields, thus when inserting it fails with an error:

- SQLCODE: -625
- validation error for column ID, value "*** null ***"

The solution is to explicitly define a sequence for each model which has a primary key, such as:

 id = Column(Integer, Sequence('user_aid_seq', optional=True), primary_key=True)

As seen here and there:

The Sequence object also implements special functionality to accommodate Postgresql’s SERIAL datatype. The SERIAL type in PG automatically generates a sequence that is used implicitly during inserts. This means that if a Table object defines a Sequence on its primary key column so that it works with Oracle and Firebird, the Sequence would get in the way of the “implicit” sequence that PG would normally use. For this use case, add the flag optional=True to the Sequence object - this indicates that the Sequence should only be used if the database provides no other option for generating primary key identifiers.

@ghost ghost assigned jadkik Jan 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant