Mar-09-2020, 04:27 AM
I try to write classes tied to a database.
I want to build properties with each fields of the database without writing all them by hand.
I'd think to do this with a metaclass that catches the fields in the database and create the associated properties by a descriptor.
But my metaclass need to access to the database. How can I pass the database connexion to the meta class before it is used to construct my class ?
Thank you.
I want to build properties with each fields of the database without writing all them by hand.
I'd think to do this with a metaclass that catches the fields in the database and create the associated properties by a descriptor.
But my metaclass need to access to the database. How can I pass the database connexion to the meta class before it is used to construct my class ?
Thank you.