Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sql_db_utils/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.0"
__version__ = "1.1.1"
14 changes: 12 additions & 2 deletions sql_db_utils/sql_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def compile_create_prefixed_id_function(element: CreatePrefixedIdFunction, _comp
next_val INTEGER;
BEGIN
next_val := nextval(seq_name);
RETURN prefix || next_val;
RETURN prefix || '_' || next_val;
END;
$$ LANGUAGE plpgsql;
"""
Expand All @@ -148,7 +148,17 @@ def compile_create_suffixed_id_function(element: CreateSuffixedIdFunction, _comp
next_val INTEGER;
BEGIN
next_val := nextval(seq_name);
RETURN next_val || suffix;
RETURN next_val || '_' || suffix;
END;
$$ LANGUAGE plpgsql;
"""


class CreateSchema(DDLElement):
def __init__(self, schema_name: str):
self.schema_name = schema_name


@compiler.compiles(CreateSchema)
def compile_create_schema(element: CreateSchema, compiler: Any, **kw: Any) -> str:
return f"CREATE SCHEMA IF NOT EXISTS {element.schema_name};"