I am running the following code in python 3.8, sqlalchemy-2.0.30.
from sqlalchemy import Column, Float, ForeignKey, Integer, String, func, or_, select
from sqlalchemy.orm import column_property, relationship
from .base import Base
from .coin import Coin
enabled = column_property(
select([func.count(Coin.symbol) == 2])
.where(or_(Coin.symbol == from_coin_id, Coin.symbol == to_coin_id))
.where(Coin.enabled.is_(True))
.scalar_subquery()
)
But I am getting the following
Exception has occurred: ArgumentError
Column expression, FROM clause, or other columns clause element expected, got [<sqlalchemy.sql.elements.BinaryExpression object at 0x0000029A14F72700>]. Did you mean to say select(<sqlalchemy.sql.elements.BinaryExpression object at 0x0000029A14F72700>)?
Is there any other expression for select([func.count(Coin.symbol) == 2])?
Thank you.