graflo.db.postgres.util¶
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Functions:¶
load_schema_from_sql_file(config, schema_file, continue_on_error=True)
¶
Load SQL schema file into PostgreSQL database.
Parses a SQL file and executes all statements sequentially. Useful for initializing a database with tables, constraints, and initial data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
PostgresConfig
|
PostgreSQL connection configuration |
required |
schema_file
|
str | Path
|
Path to SQL file to execute |
required |
continue_on_error
|
bool
|
If True, continue executing remaining statements even if one fails. If False, raise exception on first error. |
True
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If schema_file does not exist |
Exception
|
If continue_on_error is False and a statement fails |