From 9a33a99970f05d7b39969c4197600162ff539b2b Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 29 Aug 2024 12:58:57 +0300 Subject: [PATCH] fix: default of sa.column.nullable is not None --- mindsdb_sql/render/sqlalchemy_render.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mindsdb_sql/render/sqlalchemy_render.py b/mindsdb_sql/render/sqlalchemy_render.py index fd604b3..be8ac49 100644 --- a/mindsdb_sql/render/sqlalchemy_render.py +++ b/mindsdb_sql/render/sqlalchemy_render.py @@ -539,13 +539,18 @@ def prepare_create_table(self, ast_query): col.is_primary_key = True col.type = 'INT' + kwargs = { + 'primary_key': col.is_primary_key, + 'server_default': default, + } + if col.nullable is not None: + kwargs['nullable'] = col.nullable + columns.append( sa.Column( col.name, self.get_type(col.type), - primary_key=col.is_primary_key, - server_default=default, - nullable=col.nullable + **kwargs ) )