which frameworks are we talking about here ?   since yes I think if a  
framework is going to take over the job of calling "create_engine()"  
then they should provide proper inputs.  There's a lot of things which  
can be passed to create_engine() which don't work as strings.


On Nov 24, 2008, at 7:01 PM, Iain wrote:

>
> I was wondering if it would be possible to get the code changed to
> accept the poolclass argument to create_engine (and other functions?)
> optionally as a string reference to a Pool subclass rather than
> requiring the class itself.
>
> The reason I ask is because SQLAlchemy is often a component of a
> larger framework and the framework will often create the engine
> itself, allowing configuration by a config file which usually cannot
> handle having python objects other than the basic types strings,
> numbers, lists, tuples etc, so using the poolclass option requires
> changing the source of the framework which is just not a good place to
> go :)
>
> I have made a simple, temporary change to my 0.5rc4 version of
> sqlalchemy/engine/strategies.py that you're welcome to work from but
> I'm not saying it is particularly safe, elegant or otherwise :)
>
> Thanks
> Iain
>
> --- strategies.py.old   2008-11-24 13:08:45.000000000 +1030
> +++ strategies.py       2008-11-25 10:25:42.000000000 +1030
> @@ -82,6 +82,9 @@
>
>             poolclass = (kwargs.pop('poolclass', None) or
>                          getattr(dialect_cls, 'poolclass',
> poollib.QueuePool))
> +            if isinstance(poolclass,str):
> +                 exec("pcls = %s" % poolclass) in globals(), locals()
> +                 poolclass = pcls
>             pool_args = {}
>
>             # consume pool arguments from kwargs, translating a few
> of
>
> >


--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to