-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Description
Things to check first
-
I have searched the existing issues and didn't find my bug already reported there
-
I have checked that my bug is still present in the latest release
Sqlacodegen version
3.0.0rc3
SQLAlchemy version
2.0.23
RDBMS vendor
PostgreSQL
What happened?
The screenshot shows some of the issues.
- There are unused imports (can easily be fixed by running ruff after codegen)
- Missing imports, i.e.
mapped_column. - Syntax error due to a
,in line 22.
Database schema for reproducing the bug
CREATE TABLE
logs (
timestamp timestamp NOT NULL,
level text NOT NULL,
message text NOT NULL,
schedule_id bigint REFERENCES schedules (id),
worker_id text,
run_id text,
id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
);
-- sort by timestamp
CREATE INDEX logs_timestamp_desc_idx ON logs (timestamp DESC);
-- create view of logs
CREATE VIEW logs_view AS
SELECT
timestamp,
level,
message,
schedule_id,
worker_id,
run_id
FROM logs
ORDER BY timestamp DESC;np-kyokyo