However, be aware of differences between PostgreSQL and sqlite. For example
sqlite does not support recursive CTEs. But I am sure there's more.
Ladislav Lenart
On 10.9.2013 18:43, Toph Burns wrote:
Could you use an in-memory, sqlite db for your testing? For our applications,
we have an
On Sep 10, 2013, at 11:48 PM, Joe Martin jandos...@gmail.com wrote:
I need to create a new schema with some tables in it whenever a new company
record is added.
Below are my entities (defined with Flask-SqlAlchemy framework extension):
class Company(db.Model):
__tablename__ =
Hi Folks,
So we have a sort of generic table; let's call it 'Thing'. For the sake of
example, let it have two columns. An integer 'id', and a hstore 'data':
from sqlalchemy.dialects.postgresql import HSTORE
from Column, Integer
class Thing(Base):
__tablename__ = 'thing'
id =
I wrote a blog post on this very topic recently:
http://alextechrants.blogspot.fi/2013/08/unit-testing-sqlalchemy-apps.html
tiistai, 10. syyskuuta 2013 19.43.35 UTC+3 Toph Burns kirjoitti:
Could you use an in-memory, sqlite db for your testing? For our
applications, we have an
I'm trying to test code that listens to session events on all sessions. I
can't pin it on any particular session or even sessionmaker due to the
architecture of the software (sessions are explicitly instantiated on the
fly).
All is well except that the listener sticks after the test is done,
There seems to be an undocumented function named remove() in the
sqlalchemy.event module that looks like what I want, but it doesn't work:
Traceback (most recent call last):
File
/home/alex/virtualenv/triancore/lib/python3.3/site-packages/nose/case.py,
line 198, in runTest
On Sep 11, 2013, at 1:16 PM, Alex Grönholm alex.gronh...@nextday.fi wrote:
I'm trying to test code that listens to session events on all sessions. I
can't pin it on any particular session or even sessionmaker due to the
architecture of the software (sessions are explicitly instantiated on
you can either remove all the listeners for a certain type, like this:
events.MapperEvents._clear()
the other alternative is wrap your events with a set that you control:
my_listeners = set()
@event.listens_for(target, whatever)
def evt(target):
for listener in my_listeners:
On Sep 11, 2013, at 1:11 PM, Philip Scott safetyfirstp...@gmail.com wrote:
Hi Folks,
So we have a sort of generic table; let's call it 'Thing'. For the sake of
example, let it have two columns. An integer 'id', and a hstore 'data':
from sqlalchemy.dialects.postgresql import HSTORE
from
Thanks, I'll try to make it work with the latter method somehow. Clearing
all session event listeners is not an option because some of the code under
test relies on a permanent listener being there.
keskiviikko, 11. syyskuuta 2013 21.15.46 UTC+3 Michael Bayer kirjoitti:
you can either remove
`select_entity_from` finally did the trick. I did
qry =
session.query(child_query).select_entity_from(parent_query).join(child_query,
child_query.c.parent_id==parent_query.c.id)
Thanks a lot for your help!
On Wednesday, September 4, 2013 2:19:32 PM UTC+10, Michael Bayer wrote:
On Sep 3,
Thank you for your reply. Then I thought the following would work:
company_schema = 'c' + str(company_id)
db.session.execute(CreateSchema(company_schema))
db.session.commit()
meta = db.MetaData(bind=db.engine)
for table in
I've still got a question...
# This is creating an identity map (parent id - children list), but how
do we
# know the `parent.id` at this point? The query hasn't been issued yet...
collections = dict((k, list(v)) for k, v in groupby(
child_q,
Never mind. I think I know how this works now. I didn't realise that
`child_q` gets executed as soon as it's iterated (despite your comment).
Also, the `child.parent_id` is used as key to fill the dict...
On Thursday, September 12, 2013 2:54:47 PM UTC+10, gbr wrote:
I've still got a
14 matches
Mail list logo