Skip to content

Commit

Permalink
Enable delta.feature.allowColumnDefaults for all tables (#343)
Browse files Browse the repository at this point in the history
* Enable `delta.feature.allowColumnDefaults` for all tables

* Code style

Signed-off-by: Levko Kravets <[email protected]>

---------

Signed-off-by: Levko Kravets <[email protected]>
Co-authored-by: Levko Kravets <[email protected]>
  • Loading branch information
dhirschfeld and kravets-levko authored May 30, 2024
1 parent a6212b6 commit c4e8103
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/databricks/sqlalchemy/_ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ def __init__(self, dialect):

class DatabricksDDLCompiler(compiler.DDLCompiler):
def post_create_table(self, table):
post = " USING DELTA"
post = [" USING DELTA"]
if table.comment:
comment = self.sql_compiler.render_literal_value(
table.comment, sqltypes.String()
)
post += " COMMENT " + comment
return post
post.append("COMMENT " + comment)

post.append("TBLPROPERTIES('delta.feature.allowColumnDefaults' = 'enabled')")
return "\n".join(post)

def visit_unique_constraint(self, constraint, **kw):
logger.warning("Databricks does not support unique constraints")
Expand Down

0 comments on commit c4e8103

Please sign in to comment.