Hi, I have a lookup/reference table which associate several fixed names to unique ids (like an enum type). Those ids are used elsewhere as foreign keys. It would be nice to somehow state that relationship, then in my python code create a column in the child table, put in there a value which will be a string or enum, an have sqlalchemy automatically replace that with the id associated to the name in the reference table. Is there a way to get sqlalchemy to automatically get an id (integer) value for a string or enum type
Here's an example: ref_status table -------------------- id: int4 name: varchar another table ------------------ status_id: foreign key references ref_status.id Note: I have looked into sqlalchemy enum type, and that seems to work by specifying the values for the enum in python, while what I want is to have those value retrieved by name from the database. Thanks -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.