@@ -251,30 +251,38 @@ async def query_sql(self, sql: str) -> List[Dict[str, Any]]:
251251 async def use_database (self , database : str ) -> None :
252252 """Switch to a different database."""
253253 # Use DATABASE keyword for DeltaStream syntax
254- escaped_db = database if database .startswith ('"' ) and database .endswith ('"' ) else f'"{ database } "'
255- sql = f'USE DATABASE { escaped_db } '
254+ escaped_db = (
255+ database
256+ if database .startswith ('"' ) and database .endswith ('"' )
257+ else f'"{ database } "'
258+ )
259+ sql = f"USE DATABASE { escaped_db } "
256260 await self .execute_sql (sql )
257-
261+
258262 # Update the current database in memory
259263 self ._current_database = database
260264
261265 async def use_store (self , store : str ) -> None :
262266 """Switch to a different store."""
263267 # Use STORE keyword for DeltaStream syntax
264- escaped_store = store if store .startswith ('"' ) and store .endswith ('"' ) else f'"{ store } "'
265- sql = f'USE STORE { escaped_store } '
268+ escaped_store = (
269+ store if store .startswith ('"' ) and store .endswith ('"' ) else f'"{ store } "'
270+ )
271+ sql = f"USE STORE { escaped_store } "
266272 await self .execute_sql (sql )
267-
273+
268274 # Update the current store in memory
269275 self ._current_store = store
270276
271277 async def use_schema (self , schema : str ) -> None :
272278 """Switch to a different schema."""
273279 # Use SCHEMA keyword for DeltaStream syntax
274- escaped_schema = schema if schema .startswith ('"' ) and schema .endswith ('"' ) else f'"{ schema } "'
275- sql = f'USE SCHEMA { escaped_schema } '
280+ escaped_schema = (
281+ schema if schema .startswith ('"' ) and schema .endswith ('"' ) else f'"{ schema } "'
282+ )
283+ sql = f"USE SCHEMA { escaped_schema } "
276284 await self .execute_sql (sql )
277-
285+
278286 # Update the current schema in memory
279287 self ._current_schema = schema
280288
@@ -283,74 +291,74 @@ async def get_current_database(self) -> str:
283291 # If we have a cached current database, return it
284292 if self ._current_database :
285293 return self ._current_database
286-
294+
287295 # Otherwise, query LIST DATABASES to find the default database
288296 try :
289297 databases = await self .databases .list ()
290298 for db in databases :
291299 # Look for the default database
292- if hasattr (db , ' is_default' ) and db .is_default :
300+ if hasattr (db , " is_default" ) and db .is_default :
293301 self ._current_database = db .name
294302 return db .name
295-
303+
296304 # If no default found, return the first database if any exist
297305 if databases :
298306 self ._current_database = databases [0 ].name
299307 return databases [0 ].name
300308 except Exception :
301309 # If list databases fails, return empty string
302310 pass
303-
311+
304312 return ""
305313
306314 async def get_current_store (self ) -> str :
307315 """Get the current store."""
308316 # If we have a cached current store, return it
309317 if self ._current_store :
310318 return self ._current_store
311-
319+
312320 # Otherwise, query LIST STORES to find the default store
313321 try :
314322 stores = await self .stores .list ()
315323 for store in stores :
316324 # Look for the default store
317- if hasattr (store , ' is_default' ) and store .is_default :
325+ if hasattr (store , " is_default" ) and store .is_default :
318326 self ._current_store = store .name
319327 return store .name
320-
328+
321329 # If no default found, return the first store if any exist
322330 if stores :
323331 self ._current_store = stores [0 ].name
324332 return stores [0 ].name
325333 except Exception :
326334 # If list stores fails, return empty string
327335 pass
328-
336+
329337 return ""
330338
331339 async def get_current_schema (self ) -> str :
332340 """Get the current schema."""
333341 # If we have a cached current schema, return it
334342 if self ._current_schema :
335343 return self ._current_schema
336-
344+
337345 # Otherwise, query LIST SCHEMAS to find the default schema
338346 try :
339347 schemas = await self .schemas .list ()
340348 for schema in schemas :
341349 # Look for the default schema
342- if hasattr (schema , ' is_default' ) and schema .is_default :
350+ if hasattr (schema , " is_default" ) and schema .is_default :
343351 self ._current_schema = schema .name
344352 return schema .name
345-
353+
346354 # If no default found, return the first schema if any exist
347355 if schemas :
348356 self ._current_schema = schemas [0 ].name
349357 return schemas [0 ].name
350358 except Exception :
351359 # If list schemas fails, return empty string
352360 pass
353-
361+
354362 return ""
355363
356364 # Context manager support
0 commit comments