> reflection currently does not *consistently* pick up things 
> like unique constraints, check constraints, or indexes....i 
> say "consistently" because some efforts have been made to add 
> some of these things to the MySQL and Postgres dialects 
> (although i think the postgres ones might just be trac 
> tickets)...but it generally does not.

Good to know.  
 
> The reason these things aren't reflected is becasue 
> SQLAlchemy doesn't use them for anything except CREATE TABLE 
> statements, and the idea was that if youre reflecting, the 
> table is obviously already created.

Yes, I generally prefer to maintain my schema using DDL.  

> But now people are getting into "copying" table defs across  
> databases, so people are asking for stuff like this.   While I dont  
> consider this to be a core goal of SQLAlchemy, we have been 
> accepting patches for these things provided they dont 
> negatively impact reflection performance or stability.

Another usage case (possibly an unusual one), is that many table objects
that I have also have a "business key" in addition to the surrogate key,
which I define by imposing a unique constraint on them.   I'm trying to
create a metaclass that will, instantinate an object if it does not already
exist in the database, and if it does exist, return that object instead.  It
would use the unique constraints to determine whether or not the object is
already present (for example, in the UID table I discussed:

CREATE TABLE uid (
    userid bigint PRIMARY KEY DEFAULT nextval('userseq'),
    firstname character varying(255),
    initials character varying(255) UNIQUE,
    lastname character varying(255)
);

The initials would be what determines whether the user is present in the
database or not.  I can figure this information out easily by querying
Postgres system tables directly, so it's not much of an issue for me.  I
just thought I'd check to see if SQL Alchemy had a database-independent way
of doing this.  I'm sure this is a very unusual case, so I'm not suggesting
this be a reason to add unqiue constraint detection to the reflection.  

Thank you very much for your response.  It's good to know that I'm not
missing something!

Orest


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to