API Documentation¶
sqlalchemy_history
¶
Modules exported by this package:
-
make_versioned: This is the public API function of SQLAlchemy-History for making certain mappers and sessions versioned. -
remove_versioning: Remove the versioning from given mapper / session and manager.
make_versioned(mapper=Mapper, session=Session, manager=versioning_manager, plugins=None, options=None, user_cls='User')
¶
This is the public API function of SQLAlchemy-History for making certain mappers and sessions versioned. By default this applies to all mappers and all sessions.
Examples
>>> make_versioned(user_cls=None, options={'table_name': '%_tracker'})
None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapper
|
Mapper
|
SQLAlchemy mapper to apply the versioning to. (Default value = sa.orm.Mapper) |
Mapper
|
session
|
SQLAlchemy session to apply the versioning to. By default this is sa.orm.session.Session meaning it applies to all Session subclasses. |
Session
|
|
manager
|
VersioningManager
|
SQLAlchemy-History versioning manager. (Default value = versioning_manager) |
versioning_manager
|
plugins
|
Plugins to pass for versioning manager. (Default value = None) |
None
|
|
options
|
dict
|
A dictionary of VersioningManager options. (Default value = None) |
None
|
user_cls
|
User class which the Transaction class should have relationship to. This can either be a class or string name of a class for lazy evaluation. (Default value = "User") |
'User'
|
Returns:
| Type | Description |
|---|---|
NoneType
|
None |
remove_versioning(mapper=Mapper, session=Session, manager=versioning_manager)
¶
Remove the versioning from given mapper / session and manager.
Examples
>>> remove_versioning()
None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapper
|
Mapper
|
SQLAlchemy mapper to remove the versioning from. (Default value = sa.orm.Mapper) |
Mapper
|
session
|
SQLAlchemy session to remove the versioning from. By default this is sa.orm.session.Session meaning it applies to all sessions. (Default value = sa.orm.session.Session) |
Session
|
|
manager
|
VersioningManager
|
SQLAlchemy-History versioning manager. (Default value = versioning_manager) |
versioning_manager
|
Returns:
| Type | Description |
|---|---|
NoneType
|
None |