castlecraft_engineer.database.connection¶
castlecraft_engineer.database.connection
¶
get_async_engine(db_config=None)
¶
Creates and returns a new asynchronous SQLAlchemy AsyncEngine.
Configuration is sourced from the db_config dictionary, falling back
to environment variables, and then to defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_config
|
Optional[Dict[str, Any]]
|
A dictionary with optional 'async_connection_string',
'enable_sql_log', and other keyword arguments for
SQLAlchemy's |
None
|
Returns:
| Type | Description |
|---|---|
AsyncEngine
|
A new SQLAlchemy AsyncEngine instance. |
Source code in src/castlecraft_engineer/database/connection.py
get_engine(db_config=None)
¶
Creates and returns a new synchronous SQLAlchemy Engine.
Configuration is sourced from the db_config dictionary, falling back
to environment variables, and then to defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_config
|
Optional[Dict[str, Any]]
|
A dictionary with optional 'connection_string',
'enable_sql_log', and other keyword arguments for
SQLAlchemy's |
None
|
Returns:
| Type | Description |
|---|---|
Engine
|
A new SQLAlchemy Engine instance. |