File tree Expand file tree Collapse file tree 1 file changed +30
-31
lines changed Expand file tree Collapse file tree 1 file changed +30
-31
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ def version():
1919])
2020
2121class DBAPITypeObject :
22- def __init__ (self , name : str , types : set [str ]) -> None :
23- self .name = name
22+ def __init__ (self , types : list [typing .DuckDBPyType ]) -> None :
2423 self .types = types
2524
2625 def __eq__ (self , other ):
@@ -29,37 +28,37 @@ def __eq__(self, other):
2928 return False
3029
3130 def __repr__ (self ):
32- return f"<DBAPITypeObject { self .name } >"
31+ return f"<DBAPITypeObject [ { ',' . join ( str ( x ) for x in self .types ) } ] >"
3332
3433# Define the standard DBAPI sentinels
35- STRING = DBAPITypeObject ("STRING" , { " VARCHAR" } )
36- NUMBER = DBAPITypeObject ("NUMBER" , {
37- " TINYINT" ,
38- " UTINYINT" ,
39- " SMALLINT" ,
40- " USMALLINT" ,
41- " INTEGER" ,
42- " UINTEGER" ,
43- " BIGINT" ,
44- " UBIGINT" ,
45- " HUGEINT" ,
46- " UHUGEINT" ,
47- "BIGNUM" ,
48- "DECIMAL" ,
49- " FLOAT" ,
50- " DOUBLE"
51- } )
52- DATETIME = DBAPITypeObject ("DATETIME" , {
53- " DATE" ,
54- " TIME" ,
55- " TIME_TZ" ,
56- " TIMESTAMP" ,
57- " TIMESTAMP_TZ" ,
58- " TIMESTAMP_NS" ,
59- " TIMESTAMP_MS" ,
60- "TIMESTAMP_SEC"
61- } )
62- BINARY = DBAPITypeObject ("BINARY" , { " BLOB" } )
34+ STRING = DBAPITypeObject ([ typing . VARCHAR ] )
35+ NUMBER = DBAPITypeObject ([
36+ typing . TINYINT ,
37+ typing . UTINYINT ,
38+ typing . SMALLINT ,
39+ typing . USMALLINT ,
40+ typing . INTEGER ,
41+ typing . UINTEGER ,
42+ typing . BIGINT ,
43+ typing . UBIGINT ,
44+ typing . HUGEINT ,
45+ typing . UHUGEINT ,
46+ typing . DuckDBPyType ( "BIGNUM" ) ,
47+ typing . DuckDBPyType ( "DECIMAL" ) ,
48+ typing . FLOAT ,
49+ typing . DOUBLE
50+ ] )
51+ DATETIME = DBAPITypeObject ([
52+ typing . DATE ,
53+ typing . TIME ,
54+ typing . TIME_TZ ,
55+ typing . TIMESTAMP ,
56+ typing . TIMESTAMP_TZ ,
57+ typing . TIMESTAMP_NS ,
58+ typing . TIMESTAMP_MS ,
59+ typing . TIMESTAMP_S
60+ ] )
61+ BINARY = DBAPITypeObject ([ typing . BLOB ] )
6362ROWID = None
6463
6564# Classes
You can’t perform that action at this time.
0 commit comments