XYZ File Manager
Current Path:
/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
sqlalchemy
/
orm
/
📁
..
📄
__init__.py
(10.71 KB)
📄
__init__.pyc
(12.61 KB)
📄
attributes.py
(75.88 KB)
📄
attributes.pyc
(70.33 KB)
📄
base.py
(14.88 KB)
📄
base.pyc
(15.27 KB)
📄
clsregistry.py
(12.99 KB)
📄
clsregistry.pyc
(15.24 KB)
📄
collections.py
(53.44 KB)
📄
collections.pyc
(63.92 KB)
📄
context.py
(108.65 KB)
📄
context.pyc
(63.05 KB)
📄
decl_api.py
(34.72 KB)
📄
decl_api.pyc
(37.65 KB)
📄
decl_base.py
(43.69 KB)
📄
decl_base.pyc
(30.85 KB)
📄
dependency.py
(45.89 KB)
📄
dependency.pyc
(29.02 KB)
📄
descriptor_props.py
(25.38 KB)
📄
descriptor_props.pyc
(28.08 KB)
📄
dynamic.py
(15.64 KB)
📄
dynamic.pyc
(16.76 KB)
📄
evaluator.py
(7.76 KB)
📄
evaluator.pyc
(10.77 KB)
📄
events.py
(109.65 KB)
📄
events.pyc
(117.72 KB)
📄
exc.py
(6.38 KB)
📄
exc.pyc
(8.27 KB)
📄
identity.py
(7.06 KB)
📄
identity.pyc
(10.35 KB)
📄
instrumentation.py
(19.91 KB)
📄
instrumentation.pyc
(22.7 KB)
📄
interfaces.py
(31.59 KB)
📄
interfaces.pyc
(37.42 KB)
📄
loading.py
(48.16 KB)
📄
loading.pyc
(29.21 KB)
📄
mapper.py
(140.96 KB)
📄
mapper.pyc
(108.91 KB)
📄
path_registry.py
(16.01 KB)
📄
path_registry.pyc
(18.51 KB)
📄
persistence.py
(82.28 KB)
📄
persistence.pyc
(49.3 KB)
📄
properties.py
(14.44 KB)
📄
properties.pyc
(15.03 KB)
📄
query.py
(123 KB)
📄
query.pyc
(121.3 KB)
📄
relationships.py
(140.62 KB)
📄
relationships.pyc
(116.6 KB)
📄
scoping.py
(7.09 KB)
📄
scoping.pyc
(7.46 KB)
📄
session.py
(158.79 KB)
📄
session.pyc
(144.25 KB)
📄
state.py
(32.74 KB)
📄
state.pyc
(32.94 KB)
📄
strategies.py
(105.8 KB)
📄
strategies.pyc
(67.54 KB)
📄
strategy_options.py
(66.69 KB)
📄
strategy_options.pyc
(59.79 KB)
📄
sync.py
(5.69 KB)
📄
sync.pyc
(4.68 KB)
📄
unitofwork.py
(26.46 KB)
📄
unitofwork.pyc
(25.77 KB)
📄
util.py
(74.47 KB)
📄
util.pyc
(70.69 KB)
Editing: sync.py
# orm/sync.py # Copyright (C) 2005-2024 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """private module containing functions used for copying data between instances based on join conditions. """ from . import attributes from . import exc from . import util as orm_util from .. import util def populate( source, source_mapper, dest, dest_mapper, synchronize_pairs, uowcommit, flag_cascaded_pks, ): source_dict = source.dict dest_dict = dest.dict for l, r in synchronize_pairs: try: # inline of source_mapper._get_state_attr_by_column prop = source_mapper._columntoproperty[l] value = source.manager[prop.key].impl.get( source, source_dict, attributes.PASSIVE_OFF ) except exc.UnmappedColumnError as err: _raise_col_to_prop(False, source_mapper, l, dest_mapper, r, err) try: # inline of dest_mapper._set_state_attr_by_column prop = dest_mapper._columntoproperty[r] dest.manager[prop.key].impl.set(dest, dest_dict, value, None) except exc.UnmappedColumnError as err: _raise_col_to_prop(True, source_mapper, l, dest_mapper, r, err) # technically the "r.primary_key" check isn't # needed here, but we check for this condition to limit # how often this logic is invoked for memory/performance # reasons, since we only need this info for a primary key # destination. if ( flag_cascaded_pks and l.primary_key and r.primary_key and r.references(l) ): uowcommit.attributes[("pk_cascaded", dest, r)] = True def bulk_populate_inherit_keys(source_dict, source_mapper, synchronize_pairs): # a simplified version of populate() used by bulk insert mode for l, r in synchronize_pairs: try: prop = source_mapper._columntoproperty[l] value = source_dict[prop.key] except exc.UnmappedColumnError as err: _raise_col_to_prop(False, source_mapper, l, source_mapper, r, err) try: prop = source_mapper._columntoproperty[r] source_dict[prop.key] = value except exc.UnmappedColumnError: _raise_col_to_prop(True, source_mapper, l, source_mapper, r) def clear(dest, dest_mapper, synchronize_pairs): for l, r in synchronize_pairs: if ( r.primary_key and dest_mapper._get_state_attr_by_column(dest, dest.dict, r) not in orm_util._none_set ): raise AssertionError( "Dependency rule tried to blank-out primary key " "column '%s' on instance '%s'" % (r, orm_util.state_str(dest)) ) try: dest_mapper._set_state_attr_by_column(dest, dest.dict, r, None) except exc.UnmappedColumnError as err: _raise_col_to_prop(True, None, l, dest_mapper, r, err) def update(source, source_mapper, dest, old_prefix, synchronize_pairs): for l, r in synchronize_pairs: try: oldvalue = source_mapper._get_committed_attr_by_column( source.obj(), l ) value = source_mapper._get_state_attr_by_column( source, source.dict, l, passive=attributes.PASSIVE_OFF ) except exc.UnmappedColumnError as err: _raise_col_to_prop(False, source_mapper, l, None, r, err) dest[r.key] = value dest[old_prefix + r.key] = oldvalue def populate_dict(source, source_mapper, dict_, synchronize_pairs): for l, r in synchronize_pairs: try: value = source_mapper._get_state_attr_by_column( source, source.dict, l, passive=attributes.PASSIVE_OFF ) except exc.UnmappedColumnError as err: _raise_col_to_prop(False, source_mapper, l, None, r, err) dict_[r.key] = value def source_modified(uowcommit, source, source_mapper, synchronize_pairs): """return true if the source object has changes from an old to a new value on the given synchronize pairs """ for l, r in synchronize_pairs: try: prop = source_mapper._columntoproperty[l] except exc.UnmappedColumnError as err: _raise_col_to_prop(False, source_mapper, l, None, r, err) history = uowcommit.get_attribute_history( source, prop.key, attributes.PASSIVE_NO_INITIALIZE ) if bool(history.deleted): return True else: return False def _raise_col_to_prop( isdest, source_mapper, source_column, dest_mapper, dest_column, err ): if isdest: util.raise_( exc.UnmappedColumnError( "Can't execute sync rule for " "destination column '%s'; mapper '%s' does not map " "this column. Try using an explicit `foreign_keys` " "collection which does not include this column (or use " "a viewonly=True relation)." % (dest_column, dest_mapper) ), replace_context=err, ) else: util.raise_( exc.UnmappedColumnError( "Can't execute sync rule for " "source column '%s'; mapper '%s' does not map this " "column. Try using an explicit `foreign_keys` " "collection which does not include destination column " "'%s' (or use a viewonly=True relation)." % (source_column, source_mapper, dest_column) ), replace_context=err, )
Upload File
Create Folder