I understand default value is used to emit Insert statement. Is there any 
way to have default value is accessible via python object. See below example

>>> class User(Base):
...     __tablename__ = 'users'
...     id = Column(Integer, primary_key=True)
...     name = Column(String)
...     password = Column(String, default='welcome')
...
>>> ed_user = User(name='ed')
>>> print(ed_user.name)
ed
>>> print(ed_user.password)
None

Expect `print(ed_user.password)` to return 'welcome' in this case.

Adding it to a session, flush and query the object will return default 
value but is there a way to get default value without re-querying the 
object?


-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to