Re: [sqlalchemy] dynamically mapped tables with ORM

2013-10-25 Thread Tim Pierson
Hi everyone, I'm new to SQLSoup and only have a little sqlalchemy experience and I'm wondering if anyone can give me some direction on how to use the subclassed sqlsoup object outlined in previous posts. I also have more than a few talbes with no primary keys that I need dynamically mapped

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-10-25 Thread Michael Bayer
that answer is a little overkill, you can share the tables already reflected in a MetaData with a SQLSoup object like this: from sqlalchemy import create_engine # table with no PK e = create_engine(sqlite://, echo=True) e.execute( create table no_pk( id integer, data

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-10-25 Thread Tim Pierson
Sweet, Thanks! On Friday, October 25, 2013 3:56:59 PM UTC-4, Michael Bayer wrote: that answer is a little overkill, you can share the tables already reflected in a MetaData with a SQLSoup object like this: from sqlalchemy import create_engine # table with no PK e =

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread Michael Bayer
Have you looked at SQLSoup ? This library already does exactly what you're looking for. https://sqlsoup.readthedocs.org/en/latest/ 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

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread brent
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

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread brent
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

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread Michael Bayer
you can control the whole thing using map_to(): https://sqlsoup.readthedocs.org/en/latest/api.html#sqlsoup.SQLSoup.map_to , however that would mean you'd need to build the Table reflection outside of calling that in any case. Another approach might be just to subclass the SQLSoup object and

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread Michael Bayer
On Mar 4, 2013, at 2:21 PM, brent bpede...@gmail.com wrote: I found this in the archives: https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/EUyt8HUzJC8 are things still the same? Sort of, I moved SQLSoup out to its own project some time back, and its really a pretty simple

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-03-04 Thread brent
On Monday, 4 March 2013 12:33:33 UTC-7, Michael Bayer wrote: On Mar 4, 2013, at 2:21 PM, brent bped...@gmail.com javascript: wrote: I found this in the archives: https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/EUyt8HUzJC8 are things still the same? Sort of, I moved