Skip to content

Commit 9324bf1

Browse files
committed
Types: Improve type mapping for scalars and arrays
AFAIK, this is needed for reverse type lookups / reflections.
1 parent 07bba7b commit 9324bf1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/sqlalchemy_cratedb/dialect.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,23 @@
4141
"smallint": sqltypes.SmallInteger,
4242
"timestamp": sqltypes.TIMESTAMP,
4343
"timestamp with time zone": sqltypes.TIMESTAMP,
44+
"timestamp without time zone": sqltypes.TIMESTAMP,
4445
"object": ObjectType,
46+
"object_array": ObjectArray, # TODO: Can this also be improved to use `sqltypes.ARRAY`?
4547
"integer": sqltypes.Integer,
46-
"long": sqltypes.NUMERIC,
47-
"bigint": sqltypes.NUMERIC,
48+
"integer_array": sqltypes.ARRAY(sqltypes.Integer),
49+
"long": sqltypes.BIGINT,
50+
"long_array": sqltypes.ARRAY(sqltypes.BIGINT),
51+
"bigint": sqltypes.BIGINT,
52+
"bigint_array": sqltypes.ARRAY(sqltypes.BIGINT),
4853
"double": sqltypes.DECIMAL,
4954
"double precision": sqltypes.DECIMAL,
50-
"object_array": ObjectArray,
5155
"float": sqltypes.Float,
52-
"real": sqltypes.Float,
56+
"float_array": sqltypes.ARRAY(sqltypes.Float),
57+
"real": sqltypes.DOUBLE,
58+
"real_array": sqltypes.ARRAY(sqltypes.DOUBLE),
5359
"string": sqltypes.String,
54-
"text": sqltypes.String
60+
"text": sqltypes.String,
5561
}
5662
try:
5763
# SQLAlchemy >= 1.1

0 commit comments

Comments
 (0)