On Monday, 4 March 2013 12:16:49 UTC-7, brent wrote: > > > > On Monday, 4 March 2013 11:57:01 UTC-7, Michael Bayer wrote: >> >> Have you looked at SQLSoup ? This library already does exactly what >> you're looking for. >> >> https://sqlsoup.readthedocs.org/en/latest/ >> >> > wow! yeah that does do what I'm looking for. > However, I'm mapping to tables that do not have primary keys defined. So > with SQLSoup, I get: > > sqlsoup.SQLSoupError: table 'cpgIslandExt' does not have a primary > key defined > > I got the same in sqlalchemy if I don't explicitly add the name column to > the db. Any way around this? > > >> I found this in the archives: https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/EUyt8HUzJC8 are things still the same?
> For the most part, I have this working. However, the example in the gist >> shows that: >> >> len(g.cpgIslandExt.all()) != g.cpgIslandExt.count() >> >> >> What does your SQL echo output say? Looking at the queries (and the >> rows returned, if you use echo='debug') will illustrate what's being sent. >> >> A typical reason why all() returns fewer rows is when the query returns >> duplicate primary key identities - returned objects are uniqued on identity >> as they are received. The fact that the "name" column is being hardcoded >> in your base model as the sole "primary key" for all mappings is the likely >> cause of this even being possible. The reflection process already knows >> how to yield the primary key constraints defined on each table so you'd >> best rely upon that. >> >> >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.