Skip to content

Commit d4171f5

Browse files
committed
Autoincrement testing
1 parent bc72e6a commit d4171f5

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/databricks/sqlalchemy/dialect/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,19 @@ def visit_create_table(self, create, **kw):
9797
liquid_cluster_columns = []
9898
for create_column in create.columns:
9999
column = create_column.element
100-
# column is of type <class 'sqlalchemy.sql.schema.Column'>
101-
print(column.autoincrement)
102-
# Add somewhere 'if column.autoincrement:' And append correct syntax
103100
try:
104101
processed = self.process(
105102
create_column, first_pk=column.primary_key and not first_pk
106103
)
107-
print(processed)
104+
if column.autoincrement: # If doesn't work try 'is True' and == 'True'
105+
processed = "`".join(processed.split("`")[:-1]) + "`" + "BIGINT GENERATED ALWAYS AS IDENTITY"
108106
if processed is not None:
109107
text += separator
110108
separator = ", \n"
111109
text += "\t" + processed
112110
if column.primary_key:
113111
first_pk = True
112+
print(processed)
114113
except exc.CompileError as ce:
115114
util.raise_(
116115
exc.CompileError(

src/databricks/sqlalchemy/dialect/compiler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
class DatabricksTypeCompiler(compiler.GenericTypeCompiler):
55
"""Originally forked from pyhive"""
66

7-
def visit_INTEGER(self, type_, **kwargs):
8-
print(kwargs)
7+
def visit_INTEGER(self, type_):
98
return "INT"
109

1110
def visit_NUMERIC(self, type_):

0 commit comments

Comments
 (0)