From 6bf2fc5e166c7b67f1f13bced6483318a1b484c5 Mon Sep 17 00:00:00 2001 From: kyo-ago Date: Thu, 27 Nov 2025 14:19:37 +0900 Subject: [PATCH] fix: Use keyword arguments for MetaData.reflect() to avoid SQLAlchemy warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed SAWarning that occurred due to positional arguments being misinterpreted as dialect_options in SQLAlchemy 2.0. Changes: - Changed metadata.reflect() call to use explicit keyword arguments - bind=engine instead of positional argument - schema=schema instead of positional argument - views=not args.noviews instead of positional argument - only=tables instead of positional argument This resolves the warning: "Can't validate argument 'dialect_options'; can't locate any SQLAlchemy dialect named 'dialect'" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/sqlacodegen/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sqlacodegen/cli.py b/src/sqlacodegen/cli.py index 3e191a0d..89e279f9 100644 --- a/src/sqlacodegen/cli.py +++ b/src/sqlacodegen/cli.py @@ -56,7 +56,7 @@ def main() -> None: tables = args.tables.split(",") if args.tables else None schemas = args.schemas.split(",") if args.schemas else [None] for schema in schemas: - metadata.reflect(engine, schema, not args.noviews, tables) + metadata.reflect(bind=engine, schema=schema, views=not args.noviews, only=tables) # Instantiate the generator generator_class = generators[args.generator].load()