Table definition
from sqlalchemy import * testa = Table( "testa", metadata, Column("id", BigInteger, primary_key=True), Column("str_var_a", String, nullable=True), Colmn("bool_var_a", Boolean, nullable=True), )
and I need to execute a query like.
select([testa.c.id & 15])
But while executing this query getting an error
Traceback (most recent call last):
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 81, in __and__
return self.operate(and_, other)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 731, in operate
return op(self.comparator, *other, **kwargs)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 81, in __and__
return self.operate(and_, other)
File "<string>", line 1, in <lambda>
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/type_api.py", line 67, in operate
return o[0](self.expr, op, *(other + o[1:]), **kwargs)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/default_comparator.py", line 147, in _conjunction_operate
return and_(expr, other)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 2098, in and_
return cls._construct(operators.and_, True_, False_, *clauses)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 2028, in _construct
clauses = [
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 2029, in <listcomp>
_expression_literal_as_text(clause)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 4569, in _expression_literal_as_text
return _literal_as_text(element)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 4592, in _literal_as_text
return _literal_as(element, _no_text_coercion)
File "/Users/users_name/Projects/x_men/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 4582, in _literal_as
raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: SQL expression object expected, got object of type <class 'int'> instead
But in Postgres using psql command I can perform the query SELECT id & 15 FROM testa;
. Is there any support for this in sqlalchemy.
> To unsubscribe from this group and stop receiving emails from it, send an email to sqlal...@googlegroups.com.
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/7665b7ce-44fc-4a9d-baf6-5175b689e2ab%40googlegroups.com.