Skip to content

Fix SQLAlchemy 2.0 issues in create_database and document sql_query - #113

Open
dr-rodriguez wants to merge 1 commit into
astrodbtoolkit:mainfrom
dr-rodriguez:sqlalchemy2-cleanup
Open

dr-rodriguez wants to merge 1 commit into
astrodbtoolkit:mainfrom
dr-rodriguez:sqlalchemy2-cleanup

Conversation

@dr-rodriguez

Copy link
Copy Markdown
Collaborator

Closes #112. Related to #103.

Changes

  • create_database: pass bind=engine to metadata.drop_all() in both the Felis and non-Felis branches. Under SQLAlchemy 2.0, drop_tables=True previously raised TypeError: MetaData.drop_all() missing 1 required positional argument: 'bind'.
  • load_connection: remove the base.metadata.bind = engine assignment, which does nothing in SQLAlchemy 2.0.
  • sql_query: the docstring and docs/index.rst now say it is for read-only queries; INSERT, UPDATE and DELETE statements are rolled back.
  • New test test_drop_tables, which covers drop_tables=True for both branches.

Testing

  • The full suite passes locally (34 tests).
  • Against the old astrodb.py, test_drop_tables fails with the TypeError; with this change it passes.

🤖 Generated with Claude Code

- Pass bind=engine to metadata.drop_all(); drop_tables=True previously
  raised TypeError under SQLAlchemy 2.0
- Remove no-op metadata.bind assignment in load_connection
- Document sql_query as read-only (writes are rolled back)
- Add test for create_database(drop_tables=True)

Closes astrodbtoolkit#112

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dr-rodriguez dr-rodriguez self-assigned this Oct 13, 2026
@dr-rodriguez
dr-rodriguez requested a review from kelle October 13, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLAlchemy 2.0 cleanup: drop_all bind, dead metadata.bind, sql_query read-only

1 participant