sync

Sync SQLAlchemy configuration module.

class advanced_alchemy.config.sync.AlembicSyncConfig[source]

Bases: GenericAlembicConfig

Configuration for Alembic’s synchronous migrations.

For details see: https://alembic.sqlalchemy.org/en/latest/api/config.html

__init__(script_config='alembic.ini', version_table_name='alembic_versions', version_table_schema=None, script_location='migrations', user_module_prefix='sa.', render_as_batch=True, compare_type=False, template_path='/home/runner/work/advanced-alchemy/advanced-alchemy/advanced_alchemy/alembic/templates')
class advanced_alchemy.config.sync.SQLAlchemySyncConfig[source]

Bases: GenericSQLAlchemyConfig[Engine, Session, sessionmaker[Session]]

Synchronous SQLAlchemy Configuration.

Note

The alembic configuration options are documented in the Alembic documentation.

create_engine_callable(**kwargs)

Callable that creates an Engine instance or instance of its subclass.

Return type:

Engine

session_config: SyncSessionConfig

Configuration options for the sessionmaker.

__init__(create_engine_callable=<function create_engine>, session_config=<factory>, session_maker_class=<class 'sqlalchemy.orm.session.sessionmaker'>, connection_string=None, engine_config=<factory>, session_maker=None, engine_instance=None, create_all=False, metadata=None, enable_touch_updated_timestamp_listener=True, bind_key=None, alembic_config=<factory>)
session_maker_class

Sessionmaker class to use.

alias of sessionmaker

alembic_config: AlembicSyncConfig

Configuration for the SQLAlchemy Alembic migrations.

The configuration options are documented in the Alembic documentation.

get_session()[source]

Get a session context manager.

Yields:

Generator[sqlalchemy.orm.Session, None, None] – A context manager yielding an active SQLAlchemy Session.

Return type:

Generator[Session, None, None]

Examples

Using the session context manager:

>>> with config.get_session() as session:
...     session.execute(...)
class advanced_alchemy.config.sync.SyncSessionConfig[source]

Bases: GenericSessionConfig[Connection, Engine, Session]

Configuration for synchronous SQLAlchemy sessions.

__init__(autobegin=<class 'advanced_alchemy.utils.dataclass.Empty'>, autoflush=<class 'advanced_alchemy.utils.dataclass.Empty'>, bind=<class 'advanced_alchemy.utils.dataclass.Empty'>, binds=<class 'advanced_alchemy.utils.dataclass.Empty'>, class_=<class 'advanced_alchemy.utils.dataclass.Empty'>, expire_on_commit=<class 'advanced_alchemy.utils.dataclass.Empty'>, info=<class 'advanced_alchemy.utils.dataclass.Empty'>, join_transaction_mode=<class 'advanced_alchemy.utils.dataclass.Empty'>, query_cls=<class 'advanced_alchemy.utils.dataclass.Empty'>, twophase=<class 'advanced_alchemy.utils.dataclass.Empty'>)