Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-27 Thread Mike Bayer



On 02/27/2016 08:48 AM, Will Angenent wrote:

The code was just to reproduce the exact SQLA error by doing what alembic and 
SQLA are doing and additionally determining when the garbage collector runs. 
The theory is that garbage gets collected somewhere in between 
list(_mapper_registry) in configure_mappers and what happens in 
_process_dependent_arguments. The classes aren’t GC’ed since they are in use by 
the list statement, but by the time the callable is called, the module data has 
gone.


OK that specifically I can distill into a simple case which you can see 
here: 
https://bitbucket.org/zzzeek/sqlalchemy/issues/3664/un-gced-un-configured-mappers-can-be-in





I don’t consider this a bug in SQLA nor alembic individually. However, using 
the combination of the two has shown to be problematic. The randomness of the 
problem made it especially difficult to diagnose. This is probably such an edge 
case that it’s not worth spending any more time on. I’m happy I understand 
what’s going on now at least.


it's a SQLAlchemy bug, though a very edge case one.





Thanks,
Will



--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: Can I make bulk update through association proxy?

2016-02-27 Thread Mike Bayer



On 02/27/2016 07:26 AM, Piotr Dobrogost wrote:

On Friday, February 26, 2016 at 7:45:46 PM UTC+1, Jonathan Vanasco wrote:

I'm not either, and I'm scared of the SQL that would be generated
and the wire traffic/memory if there were.  That would be subselects
within subqueryloads within... this also seems a bit more about
"updates to associations" vs "association_proxy".


True. I admit this would be rather complicated but as I'm new to SA and
everybody has SA in high regard I hoped it could be capable of doing
such a thing.

Thanks for taking time to reply and for all information you provided
which is very helpful.


If I can just wrap this up, do i understand correctly that this would 
the functionality of "joined eager loading", except applied to something 
like an UPDATE..FROM ?


I think you can get pretty close to that just using plain UPDATE..FROM 
and spelling out the joins you want.  Recently we even got UPDATE..FROM 
a JOIN b working.







Regards,
Piotr

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
.
To post to this group, send email to sqlalchemy@googlegroups.com
.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-27 Thread Will Angenent
The code was just to reproduce the exact SQLA error by doing what alembic and 
SQLA are doing and additionally determining when the garbage collector runs. 
The theory is that garbage gets collected somewhere in between 
list(_mapper_registry) in configure_mappers and what happens in 
_process_dependent_arguments. The classes aren’t GC’ed since they are in use by 
the list statement, but by the time the callable is called, the module data has 
gone.

I don’t consider this a bug in SQLA nor alembic individually. However, using 
the combination of the two has shown to be problematic. The randomness of the 
problem made it especially difficult to diagnose. This is probably such an edge 
case that it’s not worth spending any more time on. I’m happy I understand 
what’s going on now at least.

Thanks,
Will

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: Can I make bulk update through association proxy?

2016-02-27 Thread Piotr Dobrogost
On Friday, February 26, 2016 at 7:45:46 PM UTC+1, Jonathan Vanasco wrote:

I'm not either, and I'm scared of the SQL that would be generated and the 
> wire traffic/memory if there were.  That would be subselects within 
> subqueryloads within... this also seems a bit more about "updates to 
> associations" vs "association_proxy".  
>

True. I admit this would be rather complicated but as I'm new to SA and 
everybody has SA in high regard I hoped it could be capable of doing such a 
thing.

Thanks for taking time to reply and for all information you provided which 
is very helpful.

Regards,
Piotr

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.