[sqlalchemy] Debug insights into QueuePool

2013-10-10 Thread John Anderson
Hey, I was wondering if it would be possible to add some extra logging to the QueuePool for when its using overflow connections vs a connection out of the pool. We currently are using a pool_size of 1 and a max overflow of 10. These were just random settings set in a library and no one really

[sqlalchemy] Using dogpile.cache example with SQLAlchemy

2013-05-27 Thread John Anderson
I'm trying to adopt the examples from: https://bitbucket.org/zzzeek/sqlalchemy/src/e2b8c893ca98/examples/dogpile_caching/ to work with my code base and so I've copy and pasted the caching_query.py into my project and started doing queries like this: DBSession = scoped_session(

Re: [sqlalchemy] Using dogpile.cache example with SQLAlchemy

2013-05-27 Thread John Anderson
provide a test case that generates that warning? On May 27, 2013, at 9:01 PM, John Anderson son...@gmail.com javascript: wrote: I'm trying to adopt the examples from: https://bitbucket.org/zzzeek/sqlalchemy/src/e2b8c893ca98/examples/dogpile_caching/ to work with my code base and so I've copy

[sqlalchemy] Out Params no longer working?

2013-04-18 Thread John Anderson
Hey, we have a lot of stored procedures that use out params like: CREATE PROCEDURE create_stuff @value INT, @id INT OUTPUT AS BEGIN INSERT into stuff ... SET @id = @@Identity END and when we rows = DBSession.execute() we reference these outparams via row['@id'] and this is fine in

[sqlalchemy] Getting generic results from an ORM query?

2013-01-02 Thread John Anderson
I would like to generate this query: SELECT a.pk, aa.response FROM attendee as a JOIN field as f on f.conference_pk = a.conference_pk LEFT JOIN attendee_answer as aa ON aa.field_pk = f.pk AND aa.attendee_pk = a.pk; Using the ORM, I came up

Re: [sqlalchemy] Getting generic results from an ORM query?

2013-01-02 Thread John Anderson
On Wednesday, January 2, 2013 1:39:28 PM UTC-3, Michael Bayer wrote: On Jan 2, 2013, at 8:33 AM, John Anderson wrote: I would like to generate this query: SELECT a.pk, aa.response FROM attendee as a JOIN field as f on f.conference_pk = a.conference_pk

[sqlalchemy] Re: Context sensitive onupdate?

2012-11-06 Thread John Anderson
Thanks! I used @validate and it worked well for what I needed. On Tuesday, November 6, 2012 3:23:47 PM UTC-3, John Anderson wrote: I update certain columns with default=foo and want that same 'foo' function to run onupdate as well, but sometimes an update will be ran only updating

[sqlalchemy] Dynamically declaring the property name of a column

2012-11-06 Thread John Anderson
I have a mixin that declares a primary key but would like to dynamically override the name of it. So for instance this is the base: class BaseModel(object): @declared_attr def pk(self): return sa.Column(sa.Integer, autoincrement=True, primary_key=True) but in some circumstances

[sqlalchemy] Re: Dynamically declaring the property name of a column

2012-11-06 Thread John Anderson
I'm using 0.8 but the library itself is open source so it might be good to support older versions. Does the 0.7 version work for both? Or is the mapper hack the best way for backwards compatibility? On Tuesday, November 6, 2012 7:42:17 PM UTC-3, John Anderson wrote: I have a mixin

[sqlalchemy] Looking up the class of a backref

2012-09-24 Thread John Anderson
If I have a DB structure similar to this: class Parent(Base): pass class Child(Base): parent = relation(Parent, backref='children') and I have an instanced of Parent and want to figure out what the class of instance.children is, how would I do that? -- You received this message

[sqlalchemy] Creating a Mako Extension

2012-08-08 Thread John Anderson
I like to manage my static assets pipeline with a framework called webassets and i'm trying to write an extension for mako and can't quite figure out what is needed based on the docs. Trying to get something like this to work: http://paste2.org/p/2098832 What is the proper way to do this?

[sqlalchemy] Re: Creating a Mako Extension

2012-08-08 Thread John Anderson
Just realized I accidentally sent this to the SQLAlchemy list instead of mako. Disregard ;) On Wednesday, August 8, 2012 1:08:16 PM UTC-5, John Anderson wrote: I like to manage my static assets pipeline with a framework called webassets and i'm trying to write an extension for mako

[sqlalchemy] Best Practice for model discovery?

2012-08-01 Thread John Anderson
In my pyramid apps I have a create script that generates my database for production and a different script that generates my database for my tests. But if I don't import the module the models are in then they aren't discovered even though they all share the same Base which is the class I get

Re: [sqlalchemy] Best Practice for model discovery?

2012-08-01 Thread John Anderson
. if the Python interpreter is never told of the existence of some .py file, it doesn't exist. it doesn't matter that Base is used in that file, the classes within don't exist until their owning module is imported. On Aug 1, 2012, at 12:07 PM, John Anderson wrote: In my pyramid apps I have

[sqlalchemy] Declaring tables without a metadata

2012-07-03 Thread John Anderson
I have a bunch of Mixins for SQL alchemy objects for doing standard stuff that I use in multiple projects and this all works well by using @declared_attr like this: class CategoryMixin(object): @declared_attr def title(self): Unique title for the category return

[sqlalchemy] Alembic says target database is not up to date.

2012-04-05 Thread John Anderson
I'm wondering how alembic decides if a database is out of date or not, I was trying to use it to autogenerate a new migration but it kept saying my database was out of date even though it wasn't. I hadn't ever ran a migration script on the database, it was an autogenerated one using create_all()