Skip to content

Commit 4315692

Browse files
committed
chore: try without sql if possible
1 parent 6642b39 commit 4315692

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

ibis/backends/pyspark/__init__.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -316,35 +316,14 @@ def _active_catalog(self, name: str | None):
316316
prev_catalog = self.current_catalog
317317
prev_database = self.current_database
318318

319-
v = self.compiler.v
320-
quoted = self.compiler.quoted
321-
dialect = self.dialect
322-
323-
catalog_sql = sge.Use(
324-
kind=v.CATALOG, this=sg.to_identifier(name, quoted=quoted)
325-
).sql(dialect)
326319
catalog_api = self._session.catalog
327320

328321
try:
329-
try:
330-
self.raw_sql(catalog_sql)
331-
except ParseException:
332-
catalog_api.setCurrentCatalog(name)
322+
catalog_api.setCurrentCatalog(name)
333323
yield
334324
finally:
335-
catalog_sql = sge.Use(
336-
kind=v.CATALOG, this=sg.to_identifier(prev_catalog, quoted=quoted)
337-
).sql(dialect)
338-
db_sql = sge.Use(
339-
kind=v.DATABASE, this=sg.to_identifier(prev_database, quoted=quoted)
340-
).sql(dialect)
341-
342-
try:
343-
self.raw_sql(catalog_sql)
344-
self.raw_sql(db_sql)
345-
except ParseException:
346-
catalog_api.setCurrentCatalog(prev_catalog)
347-
catalog_api.setCurrentDatabase(prev_database)
325+
catalog_api.setCurrentCatalog(prev_catalog)
326+
catalog_api.setCurrentDatabase(prev_database)
348327

349328
def list_catalogs(self, *, like: str | None = None) -> list[str]:
350329
catalogs = [cat.name for cat in self._session.catalog.listCatalogs()]

0 commit comments

Comments
 (0)