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?

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/7306a853-4017-4018-bc13-fa01aa8bb5adn%40googlegroups.com.

Reply via email to