Re: [sqlalchemy] Migration from 0.5 to 0.9, legacy code and InvalidRequestError: This transaction is inactive

2014-09-10 Thread christian . h . m . schramm
Am Dienstag, 9. September 2014 18:12:26 UTC+2 schrieb Jonathan Vanasco: What do you see if you drop SqlAlchemy's logging to DEBUG? I think I had a similar problem a long time ago, migrating from 0.5 to 0.8. In my case, the issue was with the `Session` factory -- i was not properly

Re: [sqlalchemy] Migration from 0.5 to 0.9, legacy code and InvalidRequestError: This transaction is inactive

2014-09-10 Thread Jonathan Vanasco
unfortunately I can't recall... I encountered this a long time ago (2010 or so), so I think it was a migration from .5 to .6x what i do remember, is that once I figured out how wrong i was about setting up the session... i was amazed that anything worked. I looked at the .5x and .6x changelogs

[sqlalchemy] SQLAlchemy connection errors

2014-09-10 Thread Matthijs Blaas
I'm expiriencing some strange bugs which seem to be caused by connections used by Sqlalchemy, which i can't pin down exactly.. i was hoping someone has a clue whats going on here. We're working on a Pyramid (version 1.5b1) webapplication and use Sqlalchemy (version 0.9.6) for all our database

[sqlalchemy] Re: SQLAlchemy connection errors

2014-09-10 Thread Jonathan Vanasco
1. I had a concern a few months ago when doing an audit of code. I ended up not having an issue, but this link might be of help: https://groups.google.com/d/topic/sqlalchemy/Z7tMCB_IK1M/discussion 2. I use `add_finished_callback`, which runs unconditionally at the end of every request.

[sqlalchemy] Re: Choosing pattern for vertical table like mapping.

2014-09-10 Thread Anton
So I am trying to do the following: class SimpleModel(object): __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) class GroupEntityAttributes(SimpleModel, db.Model): __table_args__ = {'extend_existing': True} __tablename__ = 'group_entity'

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Michael Bayer
On Sep 10, 2014, at 5:11 PM, Anton anschat...@gmail.com wrote: So I am trying to do the following: class SimpleModel(object): __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) class GroupEntityAttributes(SimpleModel, db.Model):

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Anton
Hi Mike, I have two models that I did not provide in the example: Entity and Group. Every group can assign some customer attributes to an entity, this is reflected in GroupEntityAttributes. Let's say GroupEntityAttributes(group_id=1, entity_id=1, key=color, value=red) would mean that Group 1

[sqlalchemy] does anyone have a trick for printing parenthesis on complex queries?

2014-09-10 Thread Jonathan Vanasco
SqlAlchemy's formatting is sometimes getting in the way while debugging complex queries Does anyone have a trick to explicitly print parenthesis in queries? That would make some of these queries easier to follow and/or regex for example: sqlalchemy generates stuff like this: x OR y AND z

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Michael Bayer
hi Anton - if you can show me correct table designs, e.g. as simple CREATE TABLE statements, that definitely do the thing you need, I can show you how to map to it. So far it's not clear if you're looking for schema design via SQLAlchemy's API. - mike On Sep 10, 2014, at 6:36 PM, Anton

Re: [sqlalchemy] does anyone have a trick for printing parenthesis on complex queries?

2014-09-10 Thread Michael Bayer
might be tricky, there's self_group() and Grouping(), you can probably use the latter explicitly. On Sep 10, 2014, at 6:46 PM, Jonathan Vanasco jonat...@findmeon.com wrote: SqlAlchemy's formatting is sometimes getting in the way while debugging complex queries Does anyone have a trick

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Anton
Mike, the tables are already there, I am trying to create models mapped on the tables so it is easier to work with. Tables design looks like: CREATE TABLE group ( id integer NOT NULL, name character varying ); CREATE TABLE entity ( id integer NOT NULL, name character varying );

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Anton
I already have models for group, entity and group_entity. Now I am trying to build a model that would represent an entity for a group with all the custom attributes. On Wednesday, September 10, 2014 5:06:36 PM UTC-7, Anton wrote: Mike, the tables are already there, I am trying to create

Re: [sqlalchemy] Choosing pattern for vertical table like mapping.

2014-09-10 Thread Michael Bayer
OK, just three tables, then just three mapped classes, that's it. The rest of the stuff you're trying to do has to be done using standard Python techniques; classes that implement special __getitem__() / __setitem__(), etc. Here's a start, does just the get side so far: from sqlalchemy

Re: [sqlalchemy] too many SQL variables in in_

2014-09-10 Thread pyArchInit ArcheoImagineers
Hi, if I create many or request with a little number of id (list populated with 10 values), the script return to me this message: Expression tree is too large (maximum depth 1000) So, It's possibile there is a limit for sqlite? This is a big problem for using sqlalchemy/sqlite. I cannot