-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise an assertion if a flush() occurs on changes without a proper cl…
…ock tick (#24) * Fix for issue #21: Raise an assertion if a flush() occurs on temporalized changes without a proper clock tick * Refactor invalid flush() assertion to only be active if a flag (strict_mode) is set * Bump version number to 0.3.2
- Loading branch information
1 parent
a3a3ed6
commit 3b44746
Showing
6 changed files
with
161 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ Here is an entirely incomplete list of amazing contributors. | |
|
||
Alec Clowes <[email protected]> | ||
Ben Kudria <[email protected]> | ||
Bijan Vakili <[email protected]> | ||
Dave Flerlage <[email protected]> | ||
Diego Argueta <[email protected]> | ||
George Leslie-Waksman <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import sqlalchemy.orm as orm | ||
|
||
TEMPORAL_METADATA_KEY = '__temporal' | ||
|
||
__all__ = [ | ||
'get_session_metadata', | ||
'set_session_metadata', | ||
] | ||
|
||
|
||
def set_session_metadata(session: orm.Session, metadata: dict): | ||
if isinstance(session, orm.Session): | ||
session.info[TEMPORAL_METADATA_KEY] = metadata | ||
elif isinstance(session, orm.sessionmaker): | ||
session.configure(info={TEMPORAL_METADATA_KEY: metadata}) | ||
else: | ||
raise ValueError('Invalid session') | ||
|
||
|
||
def get_session_metadata(session: orm.Session) -> dict: | ||
""" | ||
:return: metadata dictionary, or None if it was never installed | ||
""" | ||
return session.info.get(TEMPORAL_METADATA_KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""Version information.""" | ||
__version__ = '0.3.1' | ||
__version__ = '0.3.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters