Hi Simon and Michael,

On Jun 4, 8:03 am, "King Simon-NFHD78" <[email protected]>
wrote:
> Mike Driscoll wrote:
>
> > Well, I did the fake id column because SA was throwing an error on a
> > the reflected table since it didn't have a primary key defined. I
> > think I may have found a workaround though.
>
> From SA's point of view, the primary key just has to be a set of columns
> that uniquely identify a row in the database. It doesn't explicitly have
> to be defined as a primary key in the database.
>
> The reason for this is that if you retrieve an object (a row) from the
> database and modify it, there is no way to save those changes back to
> the database unless you can uniquely identify that row, so you know what
> to put in the WHERE clause of the UPDATE statement.
>
> If there really isn't a set of columns that uniquely identifies a row in
> the database, and you only want read-only support, you might be able to
> tell SA that the primary key is made up of all the columns in the table.
> However, if there are any duplicate rows in the table, SA will only
> return a single object for those rows because it has no way of knowing
> that they are different.
>
> If you do have duplicate rows, you might be better working with the
> SQL-only layer of SA, rather than the ORM.
>
> Simon

It turns out that my ultimate issue was myself. I had our db admin
(i.e. my boss) look at it and he quickly found that while my username
had access to the database, it did not have access to that particular
table. This caused autoload to report that the table did not exist AND
if I set a primary key and disabled autoload, it made SA spit out a
SELECT permission error.

I apologize for the noise. So much to learn...so little time.

- Mike
--~--~---------~--~----~------------~-------~--~----~
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