Hi,

I created a mapper inheriting from another mapper and overriding a
relation definition, and got this warning:

Warning: relation 'dimensions' on mapper 'Mapper|DataSetSlice|
dataset_slice' supercedes the same relation on inherited mapper
'Mapper|DataSet|dataset'; this can cause dependency issues during
flush

I'd like to understand those dependency issues better (read: at all),
to know whether they apply in my case.

The new class I am mapping is class DataSetSlice(DataSet), which
defines a slice out of another DataSet (identified by parent_id, a
self-join on the dataset table), but is also a DataSet in its own
right (fitting into our inventory/categorization system). So there is
an inheritance relationship and also (separately) a parent/child
relationship.

A DataSet has dimensions (many-to-many), and a DataSetSlice logically
has the same dimensions as its parent. So the DataSet mapper has this
relation:

dataset_mapper = mapper(DataSet, dataset_table
    ...,
    properties={
    'dimensions': relation(Dimension,
        secondary=dataset_dimension_association,
        order_by=dataset_dimension_association.c.dimension_id,
        backref='referencing_datasets'
        ),
    })

And the DataSetSlice (subclass) mapper has this instead:

datasetslice_mapper = mapper(DataSetSlice, datasetslice_table,
    ...,
    properties={
    'dimensions': relation(Dimension,
        secondary=dataset_dimension_association,
        primaryjoin=dataset_dimension_association.c.dataset_id
                    == datasetslice_table.c.parent_id,
        foreign_keys=[dataset_dimension_association.c.dataset_id,
                      dataset_dimension_association.c.dimension_id
                      ],
        order_by=dataset_dimension_association.c.dimension_id,
        backref='referencing_dataset_slices'
        ),
    })

The salient difference is that the primary join references parent_id
in the subclass table instead of id in the superclass table --- but
these are the same by a foreign key relationship. Thus I'm making a
slice have the same dimensions as its parent.

Could someone please explain the dependency issues that can arise from
this? (Or explain generally the kind of dependency issue this warning
refers to?)

Regards,

    - Gulli

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to