I have a Base class like this:
class FlagTable(Base):
__tablename__ = "FLAG_TABLE"
FLAG_TABLE_ID = Column(Integer, primary_key=True, autoincrement="auto")
COLUMN_1 = Column(Boolean)
COLUMN_2 = Column(Boolean)
COLUMN_3 = Column(Boolean)
I have a Python function in 'FlagTable.py' that would create a record with the ORM FlagTable object:
from FlagTable import FlagTable
def addFlagsToFlagTable(arg1, arg2, arg3):
myFlags= FlagTable(COLUMN_1=arg1, COLUMN_2=arg1, COLUMN_3=arg1)
session.add(myFlags)
session.commit()
#main code starts here
callFunc = addFlagsToFlagTable(true, false, false)
When I step through the code in debugger mode I see that the record I want to add to my postgres database table gets added at the time of the import. It does not even wait for when the addFlagsToFlagTable function gets called in my main code. My *'Base = declarative_base()'* statement is in another class which is related to FlagTable class. Can someone educate me a bit on what is going on?