@@ -43,6 +43,16 @@ def _after_create(
4343 "Excel dialect does not support autoincrement=True; value must be set explicitly" ,
4444 stacklevel = 2 ,
4545 )
46+ if getattr (col , "computed" , None ) is not None :
47+ warnings .warn (
48+ f"Column '{ col .name } ': Computed columns are not supported by excel dialect; the expression will be ignored" ,
49+ stacklevel = 2 ,
50+ )
51+ if getattr (col , "identity" , None ) is not None :
52+ warnings .warn (
53+ f"Column '{ col .name } ': Identity columns are not supported by excel dialect; auto-increment will not be applied" ,
54+ stacklevel = 2 ,
55+ )
4656
4757 import excel_dbapi
4858
@@ -172,11 +182,20 @@ def _driver_type_from_declared(type_expr: str) -> str:
172182 token = match .group (1 ) if match is not None else "TEXT"
173183 if token in {"FLOAT" , "REAL" , "DECIMAL" , "NUMERIC" , "DOUBLE" }:
174184 return "FLOAT"
185+ if token in {"SMALLINT" , "BIGINT" }:
186+ return "INTEGER"
187+ if token == "TIMESTAMP" :
188+ return "DATETIME"
175189 if token in {"INTEGER" , "BOOLEAN" , "DATE" , "DATETIME" , "TEXT" }:
176190 return token
177191 return "TEXT"
178192
179193
194+ def _coerce_bool_query_value (raw : Any ) -> bool :
195+ value = raw [0 ] if isinstance (raw , tuple ) else raw
196+ return str (value ).lower () in ("true" , "1" , "yes" )
197+
198+
180199def _parse_alter_add_column (statement : str ) -> tuple [str , str , str ] | None :
181200 match = re .match (
182201 r'^ALTER TABLE\s+("[^"]+"|[A-Za-z_][A-Za-z0-9_]*)\s+ADD\s+COLUMN\s+("[^"]+"|[A-Za-z_][A-Za-z0-9_]*)\s+(.+?)\s*;?$' ,
@@ -325,21 +344,15 @@ def create_connect_args(self, url: URL) -> ConnectArgsType:
325344 "create" : True ,
326345 }
327346
328- # Forward query parameters
329347 query = dict (url .query )
330348 if "engine" in query :
331349 kwargs ["engine" ] = query .pop ("engine" )
332350 if "autocommit" in query :
333- autocommit = query .pop ("autocommit" )
334- if isinstance (autocommit , tuple ):
335- autocommit_text = autocommit [0 ] if autocommit else ""
336- else :
337- autocommit_text = autocommit
338- kwargs ["autocommit" ] = autocommit_text .lower () in (
339- "true" ,
340- "1" ,
341- "yes" ,
342- )
351+ kwargs ["autocommit" ] = _coerce_bool_query_value (query .pop ("autocommit" ))
352+
353+ for key in ("data_only" , "sanitize_formulas" , "create" , "file_locking" ):
354+ if key in query :
355+ kwargs [key ] = _coerce_bool_query_value (query [key ])
343356
344357 return ([], kwargs )
345358
@@ -430,6 +443,10 @@ def _extract_declared_type_name(type_expr: str) -> str | None:
430443 @staticmethod
431444 def _normalize_metadata_type_name (type_name : str ) -> str :
432445 normalized = type_name .upper ()
446+ if normalized in {"SMALLINT" , "BIGINT" }:
447+ return "INTEGER"
448+ if normalized == "TIMESTAMP" :
449+ return "DATETIME"
433450 if normalized in {
434451 "FLOAT" ,
435452 "REAL" ,
@@ -736,8 +753,6 @@ def create_connect_args(self, url: URL) -> ConnectArgsType:
736753
737754 query = dict (url .query )
738755 if "readonly" in query :
739- raw = query .pop ("readonly" )
740- val = raw [0 ] if isinstance (raw , tuple ) else raw
741- kwargs ["readonly" ] = str (val ).lower () in ("true" , "1" , "yes" )
756+ kwargs ["readonly" ] = _coerce_bool_query_value (query .pop ("readonly" ))
742757
743758 return ([], kwargs )
0 commit comments