Hi All,
If I have an unmapped object which has had some attributes set on it,
what would be the best way to use that object to load a mapped object?
I didn't noticed a session.lookup(myobj) method ;-)
The specific semantics I'm looking for would be to find the rows, if
there's no rows,
Am 10.01.2013 00:45, schrieb Michael Bayer:
Can't, because as a python warning, the warnings lib caches that message
permanently, to support the typical case that the warnings filter is set to
once. If the message were unique for every value your app would slowly
leak memory
I see, bad
It seems engine created using *create_engine* is not freed after cleanup of
a session. Object graph indicates that event.listen for pool is holding
reference to engine even after session is garbage collected.
*What is the right way/api to delete an engine ?*
*UseCase*
As there are lot of
Hi!
Is there any plan for supporting declarative, function-based indexes?
I'm pretty sure I've seen a statement somewhere about supporting it in
0.8.x, but can't find it at the moment.
Right now I have to use constructs like this one:
event.listen(Line.__table__, 'after_create',
DDL(CREATE
Hi...
We are seeing many queries generated via relationship() issue this a
warning with this advice:
Consider use_labels for select() statements.
I'm trying to figure out how to set use_labels, or apply_labels on the
generated query, but I'm completely stumped.
Is it possible to do this, or
On Jan 10, 2013, at 11:48 AM, Bill Curtis wrote:
Hi...
We are seeing many queries generated via relationship() issue this a warning
with this advice:
Consider use_labels for select() statements.
I'm trying to figure out how to set use_labels, or apply_labels on the
generated query,
Hi Michael,
If you have time to take a look, I put up a short gist with some additional
detail:
https://gist.github.com/4505226
We are doing this:
# 'self' is an Article model, which is 1-to-many with Comments, which
are 1-to-1 with Users, which is 1-to-1 with Profile.
# All four
I need to run it, so can you express all four tables profiles, comments,
articles, users with enough columns as are referenced here, and some plain
placeholder classes User, Article, Comment, Profile?I don't see the usual
things that produce that warning so you might be hitting some
Okay, cool. I'll put together a runnable .py file.
On Thu, Jan 10, 2013 at 12:19 PM, Michael Bayer mike...@zzzcomputing.comwrote:
I need to run it, so can you express all four tables profiles,
comments, articles, users with enough columns as are referenced here,
and some plain placeholder
Felix,
Another technique I have used, in case you are not aware of it:
I add this:
import traceback
util.warn(str(traceback.format_stack()))
to whichever sqlalchemy .py file is producing the error, right at the point
where the error is emitted. Then whenever it happens, you get a full
On Jan 10, 2013, at 9:08 AM, Przemyslaw Wegrzyn wrote:
Hi!
Is there any plan for supporting declarative, function-based indexes? I'm
pretty sure I've seen a statement somewhere about supporting it in 0.8.x, but
can't find it at the moment.
Right now I have to use constructs like this
On Jan 10, 2013, at 3:35 AM, Chris Withers wrote:
Hi All,
If I have an unmapped object which has had some attributes set on it, what
would be the best way to use that object to load a mapped object?
I didn't noticed a session.lookup(myobj) method ;-)
what is it looking up ?what's
On Jan 10, 2013, at 8:25 AM, Anoop K wrote:
It seems engine created using create_engine is not freed after cleanup of a
session. Object graph indicates that event.listen for pool is holding
reference to engine even after session is garbage collected.
What is the right way/api to delete an
I tried session.bind.dispose() and NullPool. But engine *is still not
cleared*. It still seems to have some reference from SessionEventsDispatch
= sqlalchemy.event._DispatchDescriptor.
On Friday, 11 January 2013 05:24:19 UTC+5:30, Michael Bayer wrote:
On Jan 10, 2013, at 8:25 AM, Anoop K
this is all about whatever you've done specifically. If you have the Session
instance still around, where my_session.bind still points to your Engine, then
that Engine is still in memory - you're holding a reference to it. Similarly,
if you've assigned an event to the Session class whose
I am not holding engine or using event.listen anywhere. Code is as simple
as
def create_sn(url):
engine = create_engine(url)
return sessionmaker(bind=engine)(expire_on_commit=False)
sn = create_sn(url)
try:
sn...
finally:
sn.close()
sn.bind.dispose()
In engine/strategies.py
On Jan 11, 2013, at 12:42 AM, Anoop K wrote:
I am not holding engine or using event.listen anywhere. Code is as simple as
def create_sn(url):
engine = create_engine(url)
return sessionmaker(bind=engine)(expire_on_commit=False)
sn = create_sn(url)
try:
sn...
finally:
I tried the code in my setup.(SQLAlchemy-0.7.8-py2.6). Looks like engine
did not got GCed.
*[anoop@localhost tmp]$ p engtest.py *
*about to delete sn...*
*about to gc.collect()...*
*Traceback (most recent call last):*
* File engtest.py, line 31, in module*
*assert engine_is_removed*
there's some side effect occurring as a result of how 0.7 creates a new
subclass when using sessionmaker. Since you don't need a sessionmaker here,
please use this form:
return Session(bind=engine, expire_on_commit=False)
or upgrade to 0.8.0b2.
On Jan 11, 2013, at 1:08 AM, Anoop K wrote:
In the MySQL system I'm redoing with SQLAlchemy, there is effectively a
master' schema that exists once top-level stuff (including a table
describing projects) , and project schemas (one identical set of tables
per project), which have project-level stuff. When an object is retrieved
from a
*Great ...*
Session(bind=engine, expire_on_commit=False) fixed the problem.
Looks like 0.8.0b2 is BETA. Is it OK to use in production ?
Thanks
Anoop
On Friday, 11 January 2013 11:48:29 UTC+5:30, Michael Bayer wrote:
there's some side effect occurring as a result of how 0.7 creates a new
the sessionmaker() object is not GC-able in 0.7 right now due to event
mechanics. This issue does not exist in 0.8. I'll add a note.
On Jan 11, 2013, at 1:18 AM, Michael Bayer wrote:
there's some side effect occurring as a result of how 0.7 creates a new
subclass when using
its beta very close to release
On Jan 11, 2013, at 1:29 AM, Anoop K wrote:
Great ...
Session(bind=engine, expire_on_commit=False) fixed the problem.
Looks like 0.8.0b2 is BETA. Is it OK to use in production ?
Thanks
Anoop
On Friday, 11 January 2013 11:48:29 UTC+5:30, Michael Bayer
On Jan 11, 2013, at 1:22 AM, YKdvd wrote:
SQLA's event system has the after_attach session event. Hooking into this
works for new instances I attach to a session with add(), but does't fire
when items are loaded from a query - presumably attached means direct
userland attachment only,
the event mechanics issue applies to 0.7 and 0.8. while the engine will be
gc'ed in 0.8, the sessionmaker itself, if used, will still create an anonymous
subclass that is not cleared. creating many ad-hoc sessionmaker() objects,
while this was not its intended use, will cause memory to
OK.
So does Session(bind=engine, expire_on_commit=False) usage
always guarantee that engine and all other associated objects are cleared
on doing a session.close() + engine.dispose().
On Friday, 11 January 2013 12:27:16 UTC+5:30, Michael Bayer wrote:
the event mechanics issue applies to
On Friday, January 11, 2013 2:34:09 AM UTC-4, Michael Bayer wrote:
you can associate the instance event with the mapper() callable or
Mapper class, and it will take effect for all mapped classes.
I think that would work for my case, although I'm a little fuzzy as to the
exact syntax to
27 matches
Mail list logo