[sqlalchemy] Newbie question: Too many connections

2007-08-20 Thread mc
Hi, I keep getting The error: "DBAPIError: (Connection failed) (OperationalError) (1040, 'Too many connections')". At no time do I really need more than a few connections so I am doing something basically wrong. >From reading the doc I concluded that pooling in the simple cases is automatic. I mu

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread sdobrev
> But tacking a factory method onto a regular Python list is much > simpler with a separation of concerns: > > class FactoryCollection(list): >def create(self, options, **kw): eh sorry, i want it the hard way.. now as i think of it, its just me being lazy and fancy - preferring implicitness

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread jason kirtland
[EMAIL PROTECTED] wrote: > > On Monday 20 August 2007 18:09:41 jason kirtland wrote: >> svilen wrote: >> > And anyway i need to first create the object and just then >> > append it (the decorators will first fire event on the object >> > and just then append(), that is call me), so may have to loo

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread sdobrev
On Monday 20 August 2007 20:58:45 [EMAIL PROTECTED] wrote: > On Monday 20 August 2007 18:09:41 jason kirtland wrote: > > svilen wrote: > > > And anyway i need to first create the object and just then > > > append it (the decorators will first fire event on the object > > > and just then append(),

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread sdobrev
On Monday 20 August 2007 18:09:41 jason kirtland wrote: > svilen wrote: > > And anyway i need to first create the object and just then append > > it (the decorators will first fire event on the object and just > > then append(), that is call me), so may have to look > > further/deeper. Maybe i can

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-20 Thread jason kirtland
Arun wrote: > So in short if I specify use_unicode=True at the SA engine level > then I can skip specifying use_unicode and specify only > charset=utf8 at mysqldb level ? If you configure this DB-API driver for all-Unicode (which is what happens when you only give it a 'charset') all strings wil

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread jason kirtland
svilen wrote: > And anyway i need to first create the object and just then append it > (the decorators will first fire event on the object and just then > append(), that is call me), so may have to look further/deeper. > Maybe i can make my append create objects first and then call the > actua

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-08-20 Thread Michael Bayer
On Aug 20, 2007, at 5:35 AM, stephen emslie wrote: > > Hi. I am using a self-referential mapper to represent a multi-level > tree of parent-child relationships. Typically I've been querying each > parent for children that I am interested in. Up till now I have made a > new query for each child t

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
On Monday 20 August 2007 18:01:49 jason kirtland wrote: > svilen wrote: > > a suggestion about _list_decorators() and similar. > > they can be easily made into classes, i.e. non dynamic (and > > overloadable/patchable :-). > > The stdlib decorators end up in a static, module-level dictionary > tha

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread jason kirtland
svilen wrote: > a suggestion about _list_decorators() and similar. > they can be easily made into classes, i.e. non dynamic (and > overloadable/patchable :-). The stdlib decorators end up in a static, module-level dictionary that can be manipulated if you want to. Wouldn't this be replacing a

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
On Monday 20 August 2007 17:29:52 jason kirtland wrote: > [EMAIL PROTECTED] wrote: > > hi > > i need to have a list collection with list.appender (in SA 0.4 > > terms) that accepts either one positional arg as the value, or > > keyword args which it uses to create the value. Each collection > > in

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-20 Thread Marco Mariani
Lukasz Szybalski ha scritto: > Got another error here. but I guess its fixed in a newer version of > sqlalchemy via ticket 482 > Yes. I wasn't aware of 482 because I usually try to avoid table names that _must_ be escaped (mixed caps, reserved words, etc). >> put assign_mapper() in place of

[sqlalchemy] Re: Editing row objects

2007-08-20 Thread Michael Bayer
manipulating and holding onto RowProxy objects is a little squirrely. you probably want to convert them to dicts first: r = t.select().execute() for row in r: print dict(row) On Aug 19, 2007, at 12:59 PM, Brendan Arnold wrote: > > hi there, > > i'm treating the row objects like dictio

[sqlalchemy] Re: Using 0.4 in anger

2007-08-20 Thread Michael Bayer
On Aug 19, 2007, at 9:13 AM, Paul Johnston wrote: > > Hi, > > Couple more things: > 1) When specifying foreign_keys manually on a relation, you have to > use > table.c.column; table.column doesn't work. yes we havent taken away the "c" attribute on Table, that only applies to class-mapped a

[sqlalchemy] Re: Generate new id

2007-08-20 Thread Michael Bayer
On Aug 19, 2007, at 7:22 AM, Gennady wrote: > > Hello, > > I'm a new sqlalchemy user. I have a question about generate id. > > I have a class with __init__ method, and after some initialization > __init__ call events. Event handlers must know about id of new object. > > But if I use Sequence I d

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread jason kirtland
[EMAIL PROTECTED] wrote: > hi > i need to have a list collection with list.appender (in SA 0.4 terms) > that accepts either one positional arg as the value, or keyword args > which it uses to create the value. Each collection instance knows > what type of values to create. > [...] > Any idea

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
and no need for that __new__ replacement either - just use _list_decorators._funcs instead of _list_decorators() On Monday 20 August 2007 17:05:32 svilen wrote: > a patch, it got even tidier ;-) - > no more _tidy() calls, all automated. > > On Monday 20 August 2007 16:41:30 svilen wrote: > > a s

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
a patch, it got even tidier ;-) - no more _tidy() calls, all automated. On Monday 20 August 2007 16:41:30 svilen wrote: > a suggestion about _list_decorators() and similar. > they can be easily made into classes, i.e. non dynamic (and > overloadable/patchable :-). > > class _list_decorators( obje

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
a suggestion about _list_decorators() and similar. they can be easily made into classes, i.e. non dynamic (and overloadable/patchable :-). class _list_decorators( object): #instead of def _list_decorators() all contents/decorators stays same... _funcs = _get_decorators( locals()

[sqlalchemy] Re: Join vs. 2 selects?

2007-08-20 Thread Martin
Thank you both for your help! I tend to using 2 select-statements, because the most frequent use case will be a user who views the overview-page (containing several blog posts, possibly summarized) and then selecting a specific one to read, including comments. Thus, the blog post will most probabl

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread svilen
another thing noted, the collections instrumentation fails over old python classes (not inheriting object), e.g. class myX: ...whatever... it fails at _instrument_class(), because type(myX()) being is recognized as builtin, and apart of that the util.duck_type_collection() may fail because i

[sqlalchemy] adjacency list: filtering relations eagerly

2007-08-20 Thread stephen emslie
Hi. I am using a self-referential mapper to represent a multi-level tree of parent-child relationships. Typically I've been querying each parent for children that I am interested in. Up till now I have made a new query for each child that I am looking for, which is doesn't seem like the most effic

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-20 Thread Arun Kumar PG
So in short if I specify use_unicode=True at the SA engine level then I can skip specifying use_unicode and specify only charset=utf8 at mysqldb level ? On 8/19/07, jason kirtland <[EMAIL PROTECTED]> wrote: > > > Arun Kumar PG wrote: > >> Ok, you need to get that charset to the driver. Try re

[sqlalchemy] Re: overriding collection methods

2007-08-20 Thread sdobrev
sorry, fixed patch --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] F