can not raise NoSuchTableError for has_table method
regex = r"Table\ \'.*{}\'\ does\ not\ exist".format(re.escape(table_name))
if msg and re.search(regex, msg):
raise exc.NoSuchTableError(table_name)
else:
raise
with presto and Oracle, Oracle has table name with upper case, but table name in error message which return from presto is with lower case, so re.search method will return None, then has_table method will exit with uncaught exception.
maybe we should use re.IGNORECASE in re.search method
hitting the same issue with the memory catalog. Maybe you should update the title of the issue to:
"Presto TABLE_NOT_FOUND returns lower case table name causing has_table regex to fail"
Just upvoting this because I hit it as well. This causes the has_table method to throw an unexpected error, which can be quite painful. For example, pandas df.to_sql relies on has_table, which means you can't create tables with mixed case names
Here's a simple repro:
conn_str = 'presto://localhost:8080/memory?schema=default'
engine = sa.create_engine(conn_str)
inspector = sa.inspect(engine)
inspector.has_table("Foo", schema="default")
Unfortunately a similar situation happens with Hive. The table name in the exception is qualified by the database name (default.test in this case):
"(pyhive.exc.OperationalError) TExecuteStatementResp(status=TStatus(statusCode=3, infoMessages=['Server-side error; please check HS2 logs.'], sqlState='42S02', errorCode=10001, errorMessage='Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found default.test; Query ID: chris_20250808153810_842dd749-91db-43f8-8bd8-9bdbac6aad9a'), operationHandle=None)"
But the one I queried was not:
(Pdb) p regex
'TExecuteStatementResp.*SemanticException.*Table not found test'
So the regex doesn't match. I think I can work around it by passing schema='default' to has_table(), but I shouldn't need to do that?