'Adding where clause after HANA placeholders in SQLAlchemy
I'm trying to construct a query like this:
SELECT "Inventory".item_id, "Inventory".region
FROM "Inventory" ('PLACEHOLDER' = ('$$P_Param$$', '0'))
WHERE "Inventory".region = :region_1
My select statement is adding the HANA placeholders at the end though:
select_stmt = select(
inventory.item_id,
inventory.region
).suffix_with(placeholders).where(inventory.region== 'USA')
SELECT "Inventory".item_id, "Inventory".region
FROM "Inventory"
WHERE "Inventory".region = :region_1 ('PLACEHOLDER' = ('$$P_Param$$', '0'))
How do I suffix the from clause with the placeholders and add the where clause afterwards?
class Inventory(Base):
__tablename__ = 'Inventory'
__table_args__ = {'schema': '_SYS_BIC'}
date = Column(DateTime, primary_key=True)
item_id = Column(Integer, primary_key=True)
region = Column(String)
placeholder = "('PLACEHOLDER' = ('$$P_Param$$', '0'))"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
