Skip to content

Commit

Permalink
fix for incorrect lastrowid
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Nov 4, 2022
1 parent 2622fee commit 3ac0121
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sqlalchemy_iris/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ def get_column_specification(self, column, **kwargs):
column.primary_key
and column is column.table._autoincrement_column
):
colspec.append("SERIAL")
# colspec.append("SERIAL")
# IDENTITY and ALLOWIDENTITYINSERT = 1 in table instead of SERIAL to solve issue with LAST_IDENTITY()
colspec.append("IDENTITY")
else:
colspec.append(
self.dialect.type_compiler.process(
Expand All @@ -494,6 +496,9 @@ def get_column_specification(self, column, **kwargs):

return " ".join(colspec)

def post_create_table(self, table):
return " WITH %%CLASSPARAMETER ALLOWIDENTITYINSERT = 1"


class IRISTypeCompiler(compiler.GenericTypeCompiler):
def visit_boolean(self, type_, **kw):
Expand Down

0 comments on commit 3ac0121

Please sign in to comment.