I have a declarative model as below

    
class User(Base):
    __tablename__ = 'users'
    __table_args__ = {
        'schema':'internal',
        'extend_existing': True,
        'mustexist': True
    }


The table has a column named 'registration_date'. Since I am working with 
pandas I'd like to wrap this in a pandas timestamp when using it.
Ideally something like this would be possible:

def registration_date(self):
    return pd.to_datetime(self.registration_date)

But this causes a name collision between the mapped column and this new 
method so trying to query the column via User.registration_date will not 
work as this returns the method instead of the queryable attribute. The 
natural solution would be to rename the method but that isn't ideal as I 
want all my users to have the same idea of a registration date. Is this 
possible in sqlalchemy?

-- 
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/b7cd73e2-a69b-44e9-b2fa-bdc302c4b7f6%40googlegroups.com.

Reply via email to