[sqlalchemy] mapping to existing table with no primary key

2010-03-04 Thread robneville73
here's my issue...I have to map to an existing Oracle db table with
33million rows (yeah, I know). This table has no primary key and
worse, nothing, and I mean nothing to uniquely identify a row
(fabulous).

as a backup, I realize that I can manually issue statements to this
thing via SA, but I'd really like to use it through the ORM like I am
everything else.

this table is a transaction table, so 99% of the time, it's only
inserts. However, there is a flag on the table to indicate that it's
been processed by a batch process so that flag does get updated.

Is there some way I can map rowid or something as the primary key? I
think it's mostly safe since we aren't using partitioned tables and
since these records are effectively never deleted while the system is
running, I don't have to worry about the rowid getting reassigned on
me mid-transaciton.

My issue is that on insert or update, I don't want SA trying to
generate and/or insert into rowid for obvious reasons

Am I on the right track, any other ideas??

-- 
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.



Re: [sqlalchemy] mapping to existing table with no primary key

2010-03-04 Thread Michael Bayer
robneville73 wrote:
 here's my issue...I have to map to an existing Oracle db table with
 33million rows (yeah, I know). This table has no primary key and
 worse, nothing, and I mean nothing to uniquely identify a row
 (fabulous).

 as a backup, I realize that I can manually issue statements to this
 thing via SA, but I'd really like to use it through the ORM like I am
 everything else.

 this table is a transaction table, so 99% of the time, it's only
 inserts. However, there is a flag on the table to indicate that it's
 been processed by a batch process so that flag does get updated.

 Is there some way I can map rowid or something as the primary key? I
 think it's mostly safe since we aren't using partitioned tables and
 since these records are effectively never deleted while the system is
 running, I don't have to worry about the rowid getting reassigned on
 me mid-transaciton.

 My issue is that on insert or update, I don't want SA trying to
 generate and/or insert into rowid for obvious reasons

 Am I on the right track, any other ideas??

perhaps map to a view that adds in rowid as a surrogate primary key.  
The ORM can't do writes on this table, however.   It needs to issue an
UPDATE or a DELETE, for example, therefore needs a pk.




 --
 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.



-- 
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.