I have a model:

class ExchangeRate(Base):
    ...
    created_at = Column(DateTime, nullable=False, server_default=func.now())
    updated_at = Column(DateTime, nullable=False, server_default=func.now(),
                        server_onupdate=func.now())

Model fields `created_at` and `updated_at` have values generated by server, 
but the value is not fetched automatically:

     14         with Session() as session:
---> 15             return session.merge(exchange_rate)
     16 

ipdb> exchange_rate
ExchangeRate(currency_from='RUB', currency_to='KZT', rate=Decimal('4.77'), 
rounding_type='FLOOR', rounding_precision=-2)
ipdb> session.merge(exchange_rate)
ExchangeRate(currency_from='RUB', currency_to='KZT', rate=Decimal('4.77'), 
rounding_type='FLOOR', rounding_precision=-2)
ipdb> 

Do I do use it correctly?

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to