Re: [sqlalchemy] Using Mapped[str | None]

2022-08-31 Thread Peter Schutt
one of the nice ergonomic improvements to typing of late. Cheers:) On Wednesday, 31 August 2022 at 23:32:37 UTC+10 Mike Bayer wrote: > > > On Wed, Aug 31, 2022, at 5:00 AM, Peter Schutt wrote: > > Hi, > > I've been using 2.0 from main and notice that annotating an attribute

[sqlalchemy] Using Mapped[str | None]

2022-08-31 Thread Peter Schutt
Hi, I've been using 2.0 from main and notice that annotating an attribute with `mapped[str | None]` raises with: sqlalchemy.exc.ArgumentError: Could not locate SQLAlchemy Core type for Python type: str | None I've been able to get it to work with a couple of mods in util.typing and orm.proper

Re: [sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-25 Thread Peter Schutt
ike this helps as I go through the documentation. > Thanks very much much for your patient assistance. > > On Sunday, August 25, 2019 at 9:35:28 PM UTC-4, Peter Schutt wrote: >> >> HI Ira, >> >> Again, that is an error that originates from inside the database lay

Re: [sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-25 Thread Peter Schutt
contact.first_name AS civicrm_contact_first_name, > civicrm_address.street_address AS civicrm_address_street_address, > civicrm_address.city AS civicrm_address_city, civicrm_address.postalcode AS > civicrm_address_postalcode, civicrm_state_province.name AS > civicrm_state_province_n

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-22 Thread Peter Schutt
Some time between yesterday and today you have switched python interpreters between 2.7 and 3.6. Yesterday your errors were originating from modules located in "/Users/ihf/anaconda2/lib/python2.7/", today they seem to be coming from "~/anaconda2/lib/python3.6/". To be honest, it's better if you

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-22 Thread Peter Schutt
ialect_kwargs(self, kwargs)287 raise > TypeError(288 "Additional arguments should be "--> > 289 "named _, got '%s'" % k290 > )291 dialect_name, arg_name = m.group(1,

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-21 Thread Peter Schutt
, I didn't close the parenthesis for the placeholders example, should read: "(e.g. `%(tag_id_2)s`) are passed...". Couldn't find a way to edit the original. On Thursday, 22 August 2019 10:43:17 UTC+10, Peter Schutt wrote: > > Hi Ira, > > For example Integer(xx) sa

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-21 Thread Peter Schutt
>>>> last_name = Column(String(20), nullable=False) >>>> first_name = Column(String(20), nullable=False) >>>> class Contribution(Base): >>>> __tablename__ = "civicrm_contribution" >>>> id = Column(Integer, primary_ke

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-19 Thread Peter Schutt
I wasn't > able to get the query I posted to work due to a syntax error (probably > having to do with the quotes). I have not mapped any tables to classes. > > On Sunday, August 18, 2019 at 8:54:57 PM UTC-4, Peter Schutt wrote: >> >> Hi Ira, I'd be happy to hel

[sqlalchemy] Re: Translating sql query to sqlalchemy

2019-08-18 Thread Peter Schutt
Hi Ira, I'd be happy to help you find your feet with the SQLAlchemy ORM. In general when creating an application that uses the SQLAlchemy ORM, you would start with an Engine (for connecting to the db), a declarative base class (maps db table to python class) and a Session instance (for using a