44
55import firebolt .db as dbapi
66import sqlalchemy .types as sqltypes
7+ from firebolt .db import Cursor
78from sqlalchemy .engine import Connection as AlchemyConnection
89from sqlalchemy .engine import ExecutionContext , default
910from sqlalchemy .engine .url import URL
@@ -87,6 +88,7 @@ class FireboltDialect(default.DefaultDialect):
8788 returns_unicode_strings = True
8889 description_encoding = None
8990 supports_native_boolean = True
91+ _set_parameters : Optional [Dict [str , Any ]] = None
9092
9193 def __init__ (
9294 self , context : Optional [ExecutionContext ] = None , * args : Any , ** kwargs : Any
@@ -107,6 +109,10 @@ def create_connect_args(self, url: URL) -> Tuple[List, Dict]:
107109 "password" : url .password or None ,
108110 "engine_name" : url .database ,
109111 }
112+ parameters = dict (url .query )
113+ if "account_name" in parameters :
114+ kwargs ["account_name" ] = parameters .pop ("account_name" )
115+ self ._set_parameters = parameters
110116 # If URL override is not provided leave it to the sdk to determine the endpoint
111117 if "FIREBOLT_BASE_URL" in os .environ :
112118 kwargs ["api_endpoint" ] = os .environ ["FIREBOLT_BASE_URL" ]
@@ -257,6 +263,15 @@ def get_view_definition(
257263 ) -> str :
258264 pass
259265
266+ def do_execute (
267+ self ,
268+ cursor : Cursor ,
269+ statement : str ,
270+ parameters : Tuple [str , Any ],
271+ context : Optional [ExecutionContext ] = None ,
272+ ) -> None :
273+ cursor .execute (statement , set_parameters = self ._set_parameters )
274+
260275 def do_rollback (self , dbapi_connection : AlchemyConnection ) -> None :
261276 pass
262277
0 commit comments