Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-25 Thread jens.t...@gmail.com
Mike, I really appreciate your responses, thank you! All makes sense 邏 Jens On Tuesday, January 25, 2022 at 4:06:03 PM UTC+10 Mike Bayer wrote: > > > On Mon, Jan 24, 2022, at 11:32 PM, jens.t...@gmail.com wrote: > > Mike, thank you for elaborating, that helps a lot! Yes, I meant a transient >

Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-24 Thread Mike Bayer
On Mon, Jan 24, 2022, at 11:32 PM, jens.t...@gmail.com wrote: > Mike, thank you for elaborating, that helps a lot! Yes, I meant a transient > or pending > > object above, you’re correct. > >

Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-24 Thread jens.t...@gmail.com
Mike, thank you for elaborating, that helps a lot! Yes, I meant a transient or pending object above, you’re correct. To make sure I understand correctly: it’s ok to declare deleted_at:

Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-16 Thread Mike Bayer
On Sat, Jan 15, 2022, at 3:34 PM, jens.t...@gmail.com wrote: > Hello Mike, > > Yes that’s using the plugin: > sqlalchemy[mypy,postgresql_psycopg2binary]==1.4.29 I changed the function > declaration to this: > > @staticmethod > def create(dbsession: Session, name: str, id_:

Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-15 Thread jens.t...@gmail.com
Hello Mike, Yes that’s using the plugin: sqlalchemy[mypy,postgresql_psycopg2binary]==1.4.29 I changed the function declaration to this: @staticmethod def create(dbsession: Session, name: str, id_: typing.Union[uuid.UUID, sqlalchemy.dialects.postgresql.base.UUID] = None): and it seems

Re: [sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-13 Thread Mike Bayer
is this with the SQLAlchemy Mypy plugin? current status is for 2.0 we are looking to move away from the plugin model and pretty much change how these things work.Otherwise if this is with the plugin, you would use "id: Mapped[uuid.UUID] = ..." On Wed, Jan 12, 2022, at 9:35 PM,

[sqlalchemy] PostgreSQL UUID type, Python’s UUID — and type hints

2022-01-12 Thread jens.t...@gmail.com
Hello, For a PostgreSQL 14 db, I defined a User mapping and helper function like so: from sqlalchemy.dialects.postgresql import UUID class User(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid()) name = Column(Unicode(128))