Skip to content

Commit 366df99

Browse files
committed
test
1 parent 3fd4236 commit 366df99

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_base_sql/test_create.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from sqlalchemy import types as sa_types
23

34
from mindsdb_sql_parser import parse_sql
45
from mindsdb_sql_parser.ast import *
@@ -178,3 +179,16 @@ def test_create(self):
178179
assert str(ast).lower() == str(expected_ast).lower()
179180
assert ast.to_tree() == expected_ast.to_tree()
180181

182+
# test dump of sqlalchemy types
183+
create_table_ast = CreateTable(
184+
name=Identifier('mydb.Persons'),
185+
columns=[
186+
TableColumn(name='PersonID', type=sa_types.Integer),
187+
TableColumn(name='LastName', type=sa_types.Text),
188+
TableColumn(name='CreatedAt', type=sa_types.Date),
189+
]
190+
)
191+
192+
expected_sql = "CREATE TABLE mydb.Persons (PersonID int, LastName text, CreatedAt date)"
193+
194+
assert ' '.join(create_table_ast.to_string().split()) == expected_sql

0 commit comments

Comments
 (0)