diff --git a/cli/commands/query.py b/cli/commands/query.py index d959e2b..0055735 100644 --- a/cli/commands/query.py +++ b/cli/commands/query.py @@ -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) try: 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" - )}) + )} + # 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: if "=" not in spec: diff --git a/src/db.py b/src/db.py index 408f3e8..2069396 100644 --- a/src/db.py +++ b/src/db.py @@ -285,7 +285,7 @@ def _reattach_remote_extensions( try: has_table = conn.execute( "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() if not has_table: continue