jdcman wrote:

> As I add records,  I want the ID to Auto Increment.   When you say
> "define a constructor for your class which does not require an ID",
> but I REQUIRE an ID,  I also require the ID to increment when I add
> new record.   You went on to say "SQLALchemy has no constructor
> requirements on mapped classes",  what do you mean by that?

He meant that you don't need to have a constructor on your class.  Why are
you using it?  Have you checked if there's no logic error in your code
there?

> Ok,  so can you give me some really simple SQLAlchemy code that would
> allow me to increment the ID automatically?    Keep in mind,  that
> multiple people may be adding records,  so it has to sort all this
> out.

In PostgreSQL we use sequences.  SA automatically goes there, select the
nextval of the sequence and then use it as the id.  Since every nextval
increments the sequence, there is no problem of concurrent access and all
works beautifully.

> Am I to assume that this is beyond SQLAlchemy,  and no one else would
> ever want to do this?   And this was never designed to do this?

No.  You can think how you'd do it in the database and then model like that. 
It is MY personal belief that an ORM is an interface between code and
database, but should never replace any knowledge of database
administration, database modeling, etc. that is required to design an
application.

It will make your life easier on the code side, but will never replace all
the knowledge that YOU must have about the RDBMS server you're going to
use.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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