you can check for primary key constraints using: select table_name, constraint_name from user_constraints where constraint_type = 'P'
the orm will need to know the primary keys, but if they do not exist in the schema, you can set them when you reflect the table t = Table('t1', meta, Column('id', Integer, primary_key=True), autoload=True) On 25 Mai, 10:23, "Urko M." <urko.ma...@gmail.com> wrote: > The "primary_key" collection seems to be empty. For example, I am > reflecting the table "teachers", and the result of: > len(teachers.primary_key) > is 0. > > The table is there, and is reflected apparently correctly. And > teachers.indexes shows me a correct list of indexes. I'm not an expert > in Oracle, so maybe this is consistent with the way the database is > created. I can't change that, as it is for a commercial product. > > Are there any side effects if SQLAlchemy doesn't have a Primary Key > for a table? > > On May 24, 8:59 pm, Michael Bayer <mike...@zzzcomputing.com> wrote: > > > > > > > On May 24, 2010, at 5:34 AM, Urko M. wrote: > > > > Hi everyone, > > > > I am starting out with SQLAlchemy, and I want to use it to reflect > > > tables in an Oracle 10g database. > > > > I have been successful in that, but it seems it is not reflecting the > > > primary keys. Any ideas? > > > Or any suggestion about how to check if the keys are getting reflected > > > or not? > > > you'd check the "primary_key" collection on the Table, > > len(Table.primary_key). There's no issue I've seen before with PK columns > > not reflecting on 10g. > > > -- > > 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 > > athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- > 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 > athttp://groups.google.com/group/sqlalchemy?hl=en. -- 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.