-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
I've a functions which looks like this:
compare_commits_per_table = PGFunction(
schema=metadata_schema_name,
signature="""
compare_commits_per_table(schema_name text,
table_name text,
first_branch_id bigint, first_commit_id bigint,
second_branch_id bigint, second_commit_id bigint,
id_columns text[],
ignore_columns text[] default array ['branch_id', 'commit_id_from', 'commit_id_to'],
out table_diff jsonb)""",
definition="""
language 'plpgsql' as
$func$
...
$func$""",
)
The resulting error during alembic revision --autogenerate -m "Add diff functions" is
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near "'commit_id_from'"
LINE 1: ...bigint, id_columns text[], ignore_columns text[], 'commit_id...
^
[SQL: DROP FUNCTION "branch_metadata"."compare_commits_per_table"(schema_name text, table_name text, first_branch_id bigint, first_commit_id bigint, second_branch_id bigint, second_commit_id bigint, id_columns text[], ignore_columns text[], 'commit_id_from', 'commit_id_to'], out table_diff jsonb) ]
(Background on this error at: https://sqlalche.me/e/20/f405)
https://github.com/olirice/alembic_utils/blob/master/src/alembic_utils/pg_function.py#L90
For now I have a workaround to set the default to NULL and use coalesce( ignore_columns, array ['branch_id', 'commit_id_from', 'commit_id_to'])later, but it would have been nice to actually to use the regular default value.
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed