[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

sqlobject issue/question...

Bruce Douglas

12/29/2007 4:28:00 AM

hi....

i'm playing around, researching sqlobject, and i notice that it appears to
require the use of "id" in each tbl it handles in the database.

if i already have a db schema, and it doesn't use 'id' as an auto-generated
field, does that mean that i can't use/implement sqlobject.

is there a way to overide this function/behavior...

thanks


3 Answers

DarkBlue

12/29/2007 8:11:00 AM

0

On Dec 29, 12:27 pm, "bruce" <bedoug...@earthlink.net> wrote:
> hi....
>
> i'm playing around, researching sqlobject, and i notice that it appears to
> require the use of "id" in each tbl it handles in the database.
>
> if i already have a db schema, and it doesn't use 'id' as an auto-generated
> field, does that mean that i can't use/implement sqlobject.
>
> is there a way to overide this function/behavior...
>
> thanks

If you want to use all the power in sqlobject you will need the
"id" , you may get away without having one if you use the build in
raw sql facility exclusively , but then again you probably would
not need sqlobject anyway.

You also might want to take a look at sqlalchemy .
Whichever you choose, if you are used to write complex queries in sql
it will take some time to wrap your mind around any of them.

Db

Diez B. Roggisch

12/29/2007 12:37:00 PM

0

bruce schrieb:
> hi....
>
> i'm playing around, researching sqlobject, and i notice that it appears to
> require the use of "id" in each tbl it handles in the database.
>
> if i already have a db schema, and it doesn't use 'id' as an auto-generated
> field, does that mean that i can't use/implement sqlobject.
>
> is there a way to overide this function/behavior...

ORMs are best used not to map, but to model the data-structures. If you
already have a schema and have to keep it, SQLAlchemy might be a better
choice.

Diez

Istvan Albert

12/29/2007 2:12:00 PM

0

On Dec 28, 11:27 pm, "bruce" <bedoug...@earthlink.net> wrote:

> i'm playing around, researching sqlobject, and i notice that it appears to
> require the use of "id" in each tbl it handles in the database.

> is there a way to overide this function/behavior...

there better be such way. An ORM that does not allow you to override
what the primary keys are called would be quite limited. Look at
sqlmeta data:

http://www.sqlobject.org/SQLObject.html#cla...

i.