Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sequences on TimescaleDB like on PostgreSQL #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
_re_enum_check_constraint = re.compile(r"(?:.*?\.)?(.*?) IN \((.+)\)")
_re_enum_item = re.compile(r"'(.*?)(?<!\\)'")
_re_invalid_identifier = re.compile(r"(?u)\W")

POSTGRES_LIKE_NAMES = ("postgresql", "timescaledb",)

@dataclass
class LiteralImport:
Expand Down Expand Up @@ -646,7 +646,7 @@ def fix_column_types(self, table: Table) -> None:
pass

# PostgreSQL specific fix: detect sequences from server_default
if column.server_default and self.bind.dialect.name == "postgresql":
if column.server_default and self.bind.dialect.name in POSTGRES_LIKE_NAMES:
if isinstance(column.server_default, DefaultClause) and isinstance(
column.server_default.arg, TextClause
):
Expand Down
Loading