What happened?
Thanks for the great library! I am trying to use ibis to connect to an oracle backend, but am failing at the "con.table" step. I think this is backend specific because I have been able to connect successfully to a Snowflake backend and run ibis queries.
import oracledb
from ibis.backends.oracle import Backend
# I did this because ibis.oracle.connect failed, but that's another bug report.
with oracledb.connect(
user=user,
password=password,
dsn=dsn,
) as raw_con:
con = Backend.from_connection(raw_con)
t = con.table(table) # errors with DatabaseError: ORA-00923: FROM keyword not found where expected
cursor = oracledb.Cursor(raw_con)
cursor.execute(f"""SELECT * FROM {table}""") # works as expected
What version of ibis are you using?
12.0.0
What backend(s) are you using, if any?
Oracle
Relevant log output
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/site-packages/ibis/backends/sql/__init__.py:85, in SQLBackend.table(self, name, database)
82 catalog = table_loc.catalog or None
83 database = table_loc.db or None
---> 85 table_schema = self.get_schema(name, catalog=catalog, database=database)
86 return ops.DatabaseTable(
87 name,
88 schema=table_schema,
89 source=self,
90 namespace=ops.Namespace(catalog=catalog, database=database),
91 ).to_expr()
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/site-packages/ibis/backends/oracle/__init__.py:359, in Backend.get_schema(self, name, catalog, database)
343 database = self.con.username.upper()
344 stmt = (
345 sg.select(
346 C.column_name,
(...)
357 .order_by(C.column_id)
358 )
--> 359 with self._safe_raw_sql(stmt) as cur:
360 results = cur.fetchall()
362 if not results:
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/contextlib.py:135, in _GeneratorContextManager.__enter__(self)
133 del self.args, self.kwds, self.func
134 try:
--> 135 return next(self.gen)
136 except StopIteration:
137 raise RuntimeError("generator didn't yield") from None
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/site-packages/ibis/backends/oracle/__init__.py:267, in Backend._safe_raw_sql(self, *args, **kwargs)
265 @contextlib.contextmanager
266 def _safe_raw_sql(self, *args, **kwargs):
--> 267 with contextlib.closing(self.raw_sql(*args, **kwargs)) as result:
268 yield result
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/site-packages/ibis/backends/oracle/__init__.py:278, in Backend.raw_sql(self, query, **kwargs)
275 cursor = con.cursor()
277 try:
--> 278 cursor.execute(query, **kwargs)
279 except Exception:
280 con.rollback()
File /opt/conda/envs/Python-RT23.1-Premium/lib/python3.10/site-packages/oracledb/cursor.py:844, in Cursor.execute(self, statement, parameters, suspend_on_success, fetch_lobs, fetch_decimals, **keyword_parameters)
842 impl.fetch_decimals = fetch_decimals
843 impl.suspend_on_success = suspend_on_success
--> 844 impl.execute(self)
845 if impl.fetch_vars is not None:
846 return self
File src/oracledb/impl/thin/cursor.pyx:277, in oracledb.thin_impl.ThinCursorImpl.execute()
File src/oracledb/impl/thin/protocol.pyx:501, in oracledb.thin_impl.Protocol._process_single_message()
File src/oracledb/impl/thin/protocol.pyx:502, in oracledb.thin_impl.Protocol._process_single_message()
File src/oracledb/impl/thin/protocol.pyx:494, in oracledb.thin_impl.Protocol._process_message()
File src/oracledb/impl/thin/messages/base.pyx:102, in oracledb.thin_impl.Message._check_and_raise_exception()
DatabaseError: ORA-00923: FROM keyword not found where expected
Help: https://docs.oracle.com/error-help/db/ora-00923/
Code of Conduct
What happened?
Thanks for the great library! I am trying to use ibis to connect to an oracle backend, but am failing at the "con.table" step. I think this is backend specific because I have been able to connect successfully to a Snowflake backend and run ibis queries.
What version of ibis are you using?
12.0.0
What backend(s) are you using, if any?
Oracle
Relevant log output
Code of Conduct