~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to lib/sqlalchemy/orm/mapper.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
           See the section :ref:`concrete_inheritance` for an example.
211
211
 
212
212
        :param confirm_deleted_rows: defaults to True; when a DELETE occurs
213
 
          of one more more rows based on specific primary keys, a warning is
 
213
          of one more rows based on specific primary keys, a warning is
214
214
          emitted when the number of rows matched does not equal the number
215
215
          of rows expected.  This parameter may be set to False to handle the case
216
216
          where database ON DELETE CASCADE rules may be deleting some of those
913
913
                    if self.inherit_condition is None:
914
914
                        # figure out inherit condition from our table to the
915
915
                        # immediate table of the inherited mapper, not its
916
 
                        # full table which could pull in other stuff we dont
 
916
                        # full table which could pull in other stuff we don't
917
917
                        # want (allows test/inheritance.InheritTest4 to pass)
918
918
                        self.inherit_condition = sql_util.join_condition(
919
919
                                                    self.inherits.local_table,
1311
1311
            setter = True
1312
1312
 
1313
1313
            if isinstance(self.polymorphic_on, util.string_types):
1314
 
                # polymorphic_on specified as as string - link
 
1314
                # polymorphic_on specified as a string - link
1315
1315
                # it to mapped ColumnProperty
1316
1316
                try:
1317
1317
                    self.polymorphic_on = self._props[self.polymorphic_on]
1604
1604
        prop = self._props.get(key, None)
1605
1605
 
1606
1606
        if isinstance(prop, properties.ColumnProperty):
1607
 
            if prop.parent is self:
1608
 
                raise sa_exc.InvalidRequestError(
1609
 
                        "Implicitly combining column %s with column "
1610
 
                        "%s under attribute '%s'.  Please configure one "
1611
 
                        "or more attributes for these same-named columns "
1612
 
                        "explicitly."
1613
 
                         % (prop.columns[-1], column, key))
 
1607
            if (
 
1608
                not self._inherits_equated_pairs or
 
1609
                (prop.columns[0], column) not in self._inherits_equated_pairs
 
1610
                ) and \
 
1611
                    not prop.columns[0].shares_lineage(column) and \
 
1612
                    prop.columns[0] is not self.version_id_col and \
 
1613
                    column is not self.version_id_col:
 
1614
                warn_only = prop.parent is not self
 
1615
                msg = ("Implicitly combining column %s with column "
 
1616
                      "%s under attribute '%s'.  Please configure one "
 
1617
                      "or more attributes for these same-named columns "
 
1618
                      "explicitly." % (prop.columns[-1], column, key))
 
1619
                if warn_only:
 
1620
                    util.warn(msg)
 
1621
                else:
 
1622
                    raise sa_exc.InvalidRequestError(msg)
1614
1623
 
1615
1624
            # existing properties.ColumnProperty from an inheriting
1616
1625
            # mapper. make a copy and append our column to it
2463
2472
            # attempt to skip dependencies that are not
2464
2473
            # significant to the inheritance chain
2465
2474
            # for two tables that are related by inheritance.
2466
 
            # while that dependency may be important, it's techinically
 
2475
            # while that dependency may be important, it's technically
2467
2476
            # not what we mean to sort on here.
2468
2477
            parent = table_to_mapper.get(fk.parent.table)
2469
2478
            dep = table_to_mapper.get(fk.column.table)