-
-
Notifications
You must be signed in to change notification settings - Fork 280
Open
Labels
Milestone
Description
Things to check first
- I have searched the existing issues and didn't find my feature already requested there
Feature description
sqlacodegen/src/sqlacodegen/cli.py
Line 143 in 615d79c
| outfile = sys.stdout |
sqlacodegen/src/sqlacodegen/cli.py
Lines 94 to 129 in 615d79c
| if args.version: | |
| print(version("sqlacodegen")) | |
| return | |
| if not args.url: | |
| print("You must supply a url\n", file=sys.stderr) | |
| parser.print_help() | |
| return | |
| if citext: | |
| print(f"Using sqlalchemy-citext {version('sqlalchemy-citext')}") | |
| if geoalchemy2: | |
| print(f"Using geoalchemy2 {version('geoalchemy2')}") | |
| if pgvector: | |
| print(f"Using pgvector {version('pgvector')}") | |
| # Use reflection to fill in the metadata | |
| engine_args = _parse_engine_args(args.engine_arg) | |
| engine = create_engine(args.url, **engine_args) | |
| metadata = MetaData() | |
| tables = args.tables.split(",") if args.tables else None | |
| schemas = args.schemas.split(",") if args.schemas else [None] | |
| options = set(args.options.split(",")) if args.options else set() | |
| # Instantiate the generator | |
| generator_class = generators[args.generator].load() | |
| generator = generator_class(metadata, engine, options) | |
| if not generator.views_supported: | |
| name = generator_class.__name__ | |
| print( | |
| f"VIEW models will not be generated when using the '{name}' generator", | |
| file=sys.stderr, | |
| ) |
Instead, there should be a way to configure Logging to redirect the print statements to somewhere else (or suppress them altogether!)
Use case
sqlacodegencommand which redirects stdout to a generated file (ex: from a docker exec command)- Do anything which causes one of the
printstatements to fire, like use pgvector.
Reactions are currently unavailable