Hi there,

I got a problem about 'sqlalchemy.exc.ArgumentError: SQL expression object 
expected, got object of type <class 'property'> instead'

My SQLAlchemy version is 1.3.22. I have a database like 

Class Genome:
    id = Column(Integer, primary_key=True)
    created_date = Column(Datetime, nullable=False)

@property
def attributes(self):
     return "something"


If using the query, it reports an error through the elements.py in the 
sqlAlchemy

def _literal_as(element, text_fallback):
if isinstance(element, Visitable):
return element
elif hasattr(element, "__clause_element__"):
return element.__clause_element__()
elif isinstance(element, util.string_types):
return text_fallback(element)
elif isinstance(element, (util.NoneType, bool)):
return _const_expr(element)
else:
raise exc.ArgumentError(
"SQL expression object expected, got object of type %r "
"instead" % type(element)
)

This exception is not raised if I directly query genome's column name such 
as created_date or id. 

I am wondering 1) could the column name and property be used 
interchangeably in some way? Or say how could to query a table's property 
in the way of querying a table's column? 2) what are some significant 
differences between table's column name and property?

Thanks.

 


-- 
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/7f03c9bb-9324-4e3e-8aea-cd0d46f9021bn%40googlegroups.com.

Reply via email to