Here are the examples of the python api sqlalchemy.inspect.session taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
Source : org_request_helpers.py
with GNU Affero General Public License v3.0
from CERT-Polska
with GNU Affero General Public License v3.0
from CERT-Polska
def _get_sqla_session(self, org_request):
return sqla_inspect(org_request).session
def _get_old_value_of_scalar_attr(self, org_request, attr_name):
0
Source : test_dynamic.py
with MIT License
from sqlalchemy
with MIT License
from sqlalchemy
def _assert_history(self, obj, compare, compare_passive=None):
if isinstance(obj, self.classes.User):
attrname = "addresses"
elif isinstance(obj, self.classes.Order):
attrname = "items"
sess = inspect(obj).session
if sess:
sess.autoflush = False
try:
eq_(attributes.get_history(obj, attrname), compare)
if compare_passive is None:
compare_passive = compare
eq_(
attributes.get_history(
obj, attrname, attributes.LOAD_AGAINST_COMMITTED
),
compare_passive,
)
finally:
if sess:
sess.autoflush = True
def test_append_transient(self):
0
Source : ml_model.py
with MIT License
from tipresias
with MIT License
from tipresias
def _fetch_one(self, sql_statement: str) -> "MLModel":
self._session = self._session or inspect(self).session or Session()
return self._session.execute(sql_statement).scalars().first()