Bruce van der Kooij wrote:
On Feb 14, 5:38 pm, Michael Bayer <[email protected]> wrote:this looks like nid/vid should comprise a composite primary key ? is there a reason that's not considered here ?
Changing nid/vid on uc_products to be a composite primary key still
doesn't update vid correctly (it will remain 0). Probably because in a
normal inheritance relationship uc_products would not have a vid column.
I don't think I understand the way Drupal depicts the relationships. The
discriminator is in Node (type) so I'd assume this would at the very
least be a single inheritance table. The primary keys on the potential
concrete tables (uc_products is an example of one) however don't quite
make sense, they match node_revision more closely than they do node.
I'm still not sure how I would go about mapping these tables in
SQLAlchemy. Here are the tables on a row:
+---------------+ +---------------+
| node | | node_revision |
+---------------+ +---------------+
| nid (PK, AI) | | vid (PK, AI) |
| vid (FK) | | nid (FK) |
| uid (FK) | | uid (FK) |
| type | +---------------+
+---------------+
+---------------+ +--------------+
| uc_products | | User |
+---------------+ +--------------+
| vid (PK) | | uid (PK, AI) |
| nid (FK) | +--------------+
+---------------+
The only workaround I've been able to figure out so far is manually
executing a SQL statement outside the transaction to update the
uc_products table with the correct vid:
session.commit()
uc_products_table.update(uc_products_table.c.nid ==
node.nid).execute(vid = node.vid)
But it just seems "I'm doing it wrong" (TM).
Best regards,
Bruce
signature.asc
Description: OpenPGP digital signature
