Skip to content

Commit d3941bc

Browse files
authored
fix: support binary type (#17)
1 parent bfd10c5 commit d3941bc

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

databend_sqlalchemy/databend_dialect.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ def __init__(self, key_type, value_type):
5252
super(MAP, self).__init__()
5353

5454

55-
_type_map = {
56-
"ARRAY": sqlalchemy.types.ARRAY,
57-
"BOOLEAN": sqlalchemy.types.Boolean,
58-
"DATETIME": sqlalchemy.types.DATETIME,
59-
"DATE": sqlalchemy.types.DATE,
60-
"DOUBLE": sqlalchemy.types.Float,
61-
"FLOAT": sqlalchemy.types.Float,
62-
"INT64": sqlalchemy.types.Integer,
63-
"INTEGER": sqlalchemy.types.Integer,
64-
"NUMERIC": sqlalchemy.types.Numeric,
65-
"STRING": sqlalchemy.types.String,
66-
"TIMESTAMP": sqlalchemy.types.TIMESTAMP,
67-
}
68-
6955
# Type converters
7056
ischema_names = {
7157
"int": INTEGER,
@@ -90,6 +76,7 @@ def __init__(self, key_type, value_type):
9076
"json": JSON,
9177
"varchar": VARCHAR,
9278
"boolean": BOOLEAN,
79+
"binary": BINARY,
9380
}
9481

9582

tests/unit/test_databend_dialect.py

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def getitem(self, idx):
9999
multi_column_row(["name1", "INT", "YES"]),
100100
multi_column_row(["name2", "date", "NO"]),
101101
multi_column_row(["name3", "boolean", "YES"]),
102+
multi_column_row(["name4", "binary", "YES"])
102103
]
103104

104105
expected_query = """
@@ -135,6 +136,12 @@ def getitem(self, idx):
135136
"nullable": True,
136137
"default": None,
137138
},
139+
{
140+
"name": "name4",
141+
"type": sqlalchemy.types.BINARY,
142+
"nullable": True,
143+
"default": None,
144+
},
138145
]
139146
connection.execute.assert_called_once()
140147
assert str(connection.execute.call_args[0][0].compile()) == str(

0 commit comments

Comments
 (0)