fix: table_catalog in re-attach query, --limit in hybrid CLI

- _reattach_remote_extensions: query table_catalog instead of table_schema
  (DuckDB ATTACHed databases use table_catalog for the alias)
- _query_hybrid: forward --limit flag to RemoteQueryEngine.max_result_rows

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZdenekSrotyr 2026-04-11 20:13:35 +02:00
parent 77d369e311
commit 618385e7e4
2 changed files with 6 additions and 3 deletions

View file

@ -112,9 +112,12 @@ def _query_hybrid(sql: str, fmt: str, limit: int, register_bq_specs: List[str]):
conn = duckdb.connect(str(db_path), read_only=True) conn = duckdb.connect(str(db_path), read_only=True)
try: try:
config = load_config() config = load_config()
engine = RemoteQueryEngine(conn, **{k: v for k, v in config.items() if k in ( engine_kwargs = {k: v for k, v in config.items() if k in (
"max_bq_registration_rows", "max_memory_mb", "max_result_rows", "timeout_seconds" "max_bq_registration_rows", "max_memory_mb", "max_result_rows", "timeout_seconds"
)}) )}
# CLI --limit flag overrides config max_result_rows
engine_kwargs["max_result_rows"] = limit
engine = RemoteQueryEngine(conn, **engine_kwargs)
for spec in register_bq_specs: for spec in register_bq_specs:
if "=" not in spec: if "=" not in spec:

View file

@ -285,7 +285,7 @@ def _reattach_remote_extensions(
try: try:
has_table = conn.execute( has_table = conn.execute(
"SELECT 1 FROM information_schema.tables " "SELECT 1 FROM information_schema.tables "
f"WHERE table_schema='{ext_dir.name}' AND table_name='_remote_attach'" f"WHERE table_catalog='{ext_dir.name}' AND table_name='_remote_attach'"
).fetchone() ).fetchone()
if not has_table: if not has_table:
continue continue