lidavidm commented on code in PR #3855:
URL: https://github.com/apache/arrow-adbc/pull/3855#discussion_r2663218517
##########
python/adbc_driver_postgresql/tests/test_dbapi.py:
##########
@@ -53,6 +52,46 @@ def test_conn_change_db_schema(postgres: dbapi.Connection)
-> None:
assert postgres.adbc_current_db_schema == "dbapischema"
+def test_get_objects_schema_filter_outside_search_path(
+ postgres: dbapi.Connection,
+) -> None:
+ schema_name = "dbapi_get_objects_test"
+ table_name = "schema_filter_table"
+
+ # Regression test: adbc_get_objects(db_schema_filter=...) should not
depend on the
+ # connection's current schema/search_path.
+ assert postgres.adbc_current_db_schema == "public"
+
+ with postgres.cursor() as cur:
+ cur.execute(f'CREATE SCHEMA IF NOT EXISTS "{schema_name}"')
+ cur.execute(f'DROP TABLE IF EXISTS "{schema_name}"."{table_name}"')
+ cur.execute(f'CREATE TABLE "{schema_name}"."{table_name}" (ints INT)')
+ postgres.commit()
+
+ assert postgres.adbc_current_db_schema == "public"
+
+ metadata = (
+ postgres.adbc_get_objects(
+ depth="tables",
+ db_schema_filter=schema_name,
+ table_name_filter=table_name,
+ )
+ .read_all()
+ .to_pylist()
+ )
+
+ catalog_name = postgres.adbc_current_catalog
+ catalog = next((row for row in metadata if row["catalog_name"] ==
catalog_name), None)
Review Comment:
```suggestion
catalog = next(
(row for row in metadata if row["catalog_name"] == catalog_name),
None
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]