Re: using Modeling w/o primary keys

Sebastien Bigaret <[email protected]> Mon, 28 Jun 2004 18:44:19 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
  Hi Duncan,

Does this mean that you need to access an already existing database where *no*
primary key are defined???

PKs are important, yes, just because you need a PK to map an object w/ its
corresponding row in the database (even if you do not have a single
relationship defined in the schema). Any objkect-relational mapper will need a
way to uniquely identify a row/an object (it does not mean, however, that there
should be an attribute explictely marked as the PK in the db, only there is
exists a set of attributes (generally one) that can be taken as the PK).

I bet you have PK defined in your tables, or am I wrong? Secondly, could you
tell whether you wish read-only access to the db? (I suspect you do, but better
be sure).

-- Sébastien.


Duncan McGreggor <[email protected]> wrote:
> Hey folks,
> 
> I've got kind of an insane question... insane because Modeling is so 
> good, and I have a need to use it in a very limited fashion.
> 
> One of my clients wants to rollout support for Modeling in their python 
> applications, but wants to do it without support for primary keys. The 
> reason for this is that they are pulling meta-data out of databases 
> (i.e., basic column definitions for tables) but not anything regarding 
> relationships. They want to create attributes/properties of entities 
> based on this, and then use these models to programmatically manipulate 
> live data in the database.
> 
> Is using Modeling w/o support for primary keys possible? I have been 
> trying to do something like this, but it violates rules for valid 
> models in Modeling, and as such, it won't create any .py package model 
> files. My attempts at tweaking the code to disable support for PKs have 
> been catastrophic, as it seems it is woven into the very fabric of the 
> software. Is there a crazy hack I can use until the client is ready to 
> support primary keys in the meta-data extraction process?
> 
> Thanks for any help or advice!
> 
> Duncan



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com