Skip to content

Fix selected catalog persistence and completion refresh - #89

Open
dajiaohuang wants to merge 2 commits into
dbcli:mainfrom
dajiaohuang:fix/catalog-state-20261016
Open

dajiaohuang wants to merge 2 commits into
dbcli:mainfrom
dajiaohuang:fix/catalog-state-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown

Description

Keep the catalog selected by [catalog.]database consistent across connections:

  • Starting with athenacli custom.analytics stores analytics as the database, but the completion refresher creates a new executor with only that database. It therefore reconnects to AwsDataCatalog, so completion metadata comes from a different catalog than queries.
  • use other.reporting connects to other but does not update the stored catalog. A subsequent use archive, reconnect, or completion refresh returns to the old catalog.

Preserve the catalog after a successful database change and pass it explicitly into the completion executor. The default remains AwsDataCatalog; qualified database arguments still select the catalog. This follows the catalog/USE behavior introduced by #82.

Validation: offline pytest on Python 3.11: 58 passed, 1 XPASS, including four new tests for refresh, database changes/reconnect, the default catalog, and failed connection state. Also exercised the public CLI and AthenaCli.change_db with an owned PyAthena connection mock; baseline refresh selected AwsDataCatalog, corrected refresh selected custom.

All execution used isolated HOME/config, synthetic credentials, disabled SDK credential discovery and blocked network connections. No real Athena/S3/IAM request or paid query was made; live AWS and Python 3.6–3.8 acceptance are untested. Existing deprecation warnings remain.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant