Hi all,
I have a really short experience of python so it can be really stupid question.
I tried to understanding about declarative_base().
Example below:
Base = declarative_base()
class Bus(Base):
__tablename__ = 'bus'
....
In my understanding, That python code look like function or class. So it will be
return some value or instance.
In SQLAlchemy, declarative_base() return something and then, Bus class
inherit that Base. I saw the code in SQLAlchemy, But I can't understand what
exactly supposed to be.
>>> Base = declarative_base()
>>> Base
<class 'sqlalchemy.ext.declarative.api.Base'>
How this function is return class, not instance? Is it kind of design pattern?
I know It is not a big deal for just using SQLAlchemy, but I can't explain what it is
and how can return the class.
Please let me know what I need to know about this pattern or style.
Thanks,
Edward.