Well it looks like if I use column objects in a dict then it works out. For example:
...insert({Event.start_time: datetime.utcnow()}) On Tuesday, December 22, 2020 at 2:16:23 AM UTC-6 Michael Merickel wrote: > Is there a way to make the following insert statement work by changing > something in the Event object's definition? Note I've simplified the > example, the reasons for using the core constructs in the first place are > to use postgres ON CONFLICT directives with it otherwise yes I could simply > use the ORM where the synonyms would work fine. > > class Event(Base): > id = Column(BigInteger, primary_key=True) > start_date = Column(DateTime) > start_time = synonym('start_date') > > > dbsession.execute(insert(Event.__table__).values(start_time=datetime.utcnow()).returning(Event.id)).scalar() > > Error raised, presumably because a core insert construct doesn't support > column aliases defined at the mapper level? > > sqlalchemy.exc.CompileError: Unconsumed column names: start_time > > Thanks! > > - Michael > > -- 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/c20edd8d-78e9-4efb-a040-27d262be48b1n%40googlegroups.com.