In Python, modules are executed when they are imported. Class
definitions are executable statements, where the metaclass is called
to construct the *class*. When you import a module containing
declarative classes, the SQLAlchemy metaclass is called for each of
those classes, building the mappings, registering the polymorphic
identities and so on.

Simon

On Fri, Jul 5, 2019 at 10:58 AM natsjoo sodillepa <[email protected]> wrote:
>
> For the curious. One thing that lingers around is the question: how does 
> SQLalchemy make the connection between the parent and the child classes?
>
> In the separate modules, where the child classes are defined there is no 
> other code. The only thing that gets executed is the class construction, but 
> as
> far as I know that doesn't trigger execution of code in the parent class. I 
> know that SQLalchemy uses a metaclass but that's used only for
> instantiation of instances, not of classes, or is it?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/c90cafee-13a4-4759-99a7-b2fd656697b2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAFHwexebd5F9HXSX_kcBCY3Xey9aiPLThLX3h6GD1v7bomXd%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to