The extract code you posted is incorrect.

You were given a step towards the right answer - you MUST invoke `register`.

I say a step, because there may be other factors going on.

However as you can see from the source code 
(https://github.com/zopefoundation/zope.sqlalchemy/blob/master/src/zope/sqlalchemy/datamanager.py#L293-L329),
 
the call to `register` is required because it invokes the 
ZopeTransactionExtenstion AND sets up the transaction events.

On Saturday, October 24, 2020 at 10:47:27 AM UTC-4 dever...@gmail.com wrote:

> I'm updating a working Pyramid app that uses sqlalchemy and have some 
> success by replacing ZopeTransactionExtension with ZopeTransactionEvents.
>
> On running initialise with my local .ini file, All goes well, the database 
> tables (MariaDB) are all written, but these errors occur:
>
> Traceback (most recent call last): "[...]sqlalchemy/util/_collections.py", 
> line 1055, in __call__ return self.registry.value AttributeError: 
> '_thread._local' object has no attribute 'value' During handling of the 
> above exception, another exception occurred: 
>
> [cruft omitted]
> "[...]sqlalchemy/orm/deprecated_interfaces.py", line 367, in 
> _adapt_listener ls_meth = getattr(listener, meth) AttributeError: 
> 'ZopeTransactionEvents' object has no attribute 'after_commit'
>
> For more code details, I've posted extracts from the models and main app 
> code on StackOverflow <https://stackoverflow.com/q/64486574/123033>, but 
> with no joy so far.
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/1de6b5a3-4ca0-489a-abf6-4f4c582d6cc9n%40googlegroups.com.

Reply via email to