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 ) )