No tienes permiso para borrar mensajes de este grupo
Copiar el vínculo
Denunciar mensaje
Mostrar el mensaje original
Las direcciones de correo electrónico son anónimas para este grupo, o bien, necesitas un permiso que te permita visualizar las direcciones de correo electrónico de los miembros a fin de ver el mensaje original
para sqlalchemy
Hello,
I'm having a problem trying to cleanup sqlalchemy objects. My application has a thread which handles DB connections. In some cases the thread dies and I want to do a cleanup so, next time the thread is started it would be able to reconnect again.
But when I start a new thread, errors like this appear:
sqlalchemy.exc.ArgumentError: Column object 'column' already assigned to Table 'table'
Simon King
no leída,
25 mar 2020, 6:55:13 a.m.25/3/2020
Responder al autor
Accede para responder al autor
Reenviar
Accede para reenviar el mensaje
Eliminar
No tienes permiso para borrar mensajes de este grupo
Copiar el vínculo
Denunciar mensaje
Mostrar el mensaje original
Las direcciones de correo electrónico son anónimas para este grupo, o bien, necesitas un permiso que te permita visualizar las direcciones de correo electrónico de los miembros a fin de ver el mensaje original
para sqlal...@googlegroups.com
It's difficult to answer this question without knowing how your code
is structured. Are you reflecting your tables from the database, or
have you defined them statically?
What is the full stack trace when you get those errors?
No tienes permiso para borrar mensajes de este grupo
Copiar el vínculo
Denunciar mensaje
Mostrar el mensaje original
Las direcciones de correo electrónico son anónimas para este grupo, o bien, necesitas un permiso que te permita visualizar las direcciones de correo electrónico de los miembros a fin de ver el mensaje original
para noreply-spamdigest via sqlalchemy
you should not be calling metadata.clear() and it looks like you are doing something where you are building Table objects on the fly, re-using the same Column objects a second time, leading to the error you are seeing. There should be a single MetaData object that is not part of an object, e.g. it's a global variable in your program (e.g. not "self.metadata").
Similarly for the engine, there should not be a "self.engine", there should be a single Engine object that is also a global variable in your program. It is also threadsafe and can be shared among multiple threads.
Javier Collado Jiménez
no leída,
26 mar 2020, 3:25:06 a.m.26/3/2020
Responder al autor
Accede para responder al autor
Reenviar
Accede para reenviar el mensaje
Eliminar
No tienes permiso para borrar mensajes de este grupo
Copiar el vínculo
Denunciar mensaje
Mostrar el mensaje original
Las direcciones de correo electrónico son anónimas para este grupo, o bien, necesitas un permiso que te permita visualizar las direcciones de correo electrónico de los miembros a fin de ver el mensaje original
para sqlalchemy
Thank you Mike!
I'm going to try this different approach.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlal...@googlegroups.com.