[sqlalchemy] [alembic] equivalent to `makemigrations --check`

2024-03-11 Thread Chris Withers
Hi, I got a bounce-back from attempting to email the old alembic google group, so trying here instead! Does Alembic have an equivalent to django's "makemigrations --check"? This is a thing you can use in CI on pull requests to ensure no changes have been made to the model that are not

Re: [sqlalchemy] Composite columns and None

2024-02-15 Thread jens.t...@gmail.com
I wanted to follow up on this thread. Mike’s suggestion above worked, and considering the related discussion Dataclasses and Composites with init-only variables I

Re: [sqlalchemy] Composite columns and None

2023-11-26 Thread jens.t...@gmail.com
Thank you, Mike, for the suggestion! Another thought I mulled over was to create a new *point* table and then use a nullable FK from the *vertex* table. That way, the *Point* class can map to its own dedicated table, and a *Vertex* class would then use a relationship that’s able to map

[sqlalchemy] test email

2023-11-22 Thread Mike Bayer
this is a test. -- 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

[sqlalchemy] TechTool Pro 11.0.6 Build 5444

2023-11-21 Thread Александр Неклюдов
How to Test and Repair Your Mac with TechTool Pro 11.0.6 Build 5444If you want to keep your Mac running smoothly and avoid data loss, you need a reliable tool that can perform various tests and repairs on your system. TechTool Pro 11.0.6 Build 5444 is one of the most comprehensive and powerful

[sqlalchemy] RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR 

2023-11-19 Thread Bang Rudi
RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR !!! Untuk website terpercaya hanya di link di bawah ini, GARANSI 100% WIHTDRAW MAIN DISINI  https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip

[sqlalchemy] RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR 

2023-11-19 Thread Bang Rudi
RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR !!! Untuk website terpercaya hanya di link di bawah ini, GARANSI 100% WIHTDRAW MAIN DISINI  https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip

[sqlalchemy] RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR 

2023-11-19 Thread Andi Rahayu
RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR !!! Untuk website terpercaya hanya di link di bawah ini, GARANSI 100% WIHTDRAW MAIN DISINI  https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip

[sqlalchemy] RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR 

2023-11-19 Thread Riky Susanto
RUPIAH TOTO WEBSITE PENIPU DEPOSIT TIDAK DI PROSES WD TIDAK DI BAYAR !!! Untuk website terpercaya hanya di link di bawah ini, GARANSI 100% WIHTDRAW MAIN DISINI  https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip https://surelink.online/vip

[sqlalchemy] MPL777 LINK ALTERNATIF DIBAWAH INI  ANTI BLOKIR

2023-11-18 Thread Bang Toyib
*MPL777INFO LINK UTAMA  :* https://mpl777.link/masuk *LIVE CHAT 24 JAM SIAP MEMBANTU  :*https://mpl777.link/chat *YOUTUBE PANDUAN ANTI BLOKIR  : *https://prnt.sc/soHyt4uFGX7F 홄홉홁홊 홆홊홉홏혼홆 홏홀홍혽혼홍홐⬇ : WA : https://heyboy.link/whatsapp TELEGRAM :https://telegram.me/MPL777 Download APK :

[sqlalchemy] SERING RUNGKAT MAIN DI WEBSITE LAIN ? BERALIH KE GAMEPLAY777 TGARANSI WD 100%

2023-11-17 Thread Andi Rahayu
Rungkat Terus Main Diwebsite Lain ? Kesal Dengan Pelayanan CS Yang Lemot ? Sering Dijanjikan RTP 99% Tapi Hasilnya Nol ? Semua Permasalahan Diatas  Hanya di GAMEPLAY777 Solusinya, Website Server Thailand No 1 Di Indonesia LINK DI BAWAH INI : https://surelink.online/siputih

[sqlalchemy] Selamat Datang & Selamat bergabung di website *Gacor GAMEPLAY777* WEBSITE TERGACOR & WEBSITE TERPERCAYA 2023

2023-11-17 Thread Bang Toyib
Rungkat Terus Main Diwebsite Lain ? Kesal Dengan Pelayanan CS Yang Lemot ? Sering Dijanjikan RTP 99% Tapi Hasilnya Nol ? Semua Permasalahan Diatas  Hanya di GAMEPLAY777 Solusinya, Website Server Thailand No 1 Di Indonesia GAMEPLAY777 adalah situs slot dengan beragam permainan terbaik di

[sqlalchemy] Situs Santoto Min Depo 10rb | Min WD 50rb

2023-11-16 Thread Ocin
Link Daftar Santoto : https://heylink.me/jpm4xwiin Link Login Santoto : https://linkr.bio/loginsantoto Link Santoto Gacor : https://linklist.bio/santoto Link Anti Blokir Santoto : https://maxsantoto.com/ Link Alternatif Santoto : https://arenasan.xyz/ SANTOTO » SITUS BANDAR TOGEL ONLINE

[sqlalchemy] Re: ✅TOTOJITU, ✅DAFTAR TOTOJITU, ✅SITUS TOTOJITU, ✅LINK TOTOJITU

2023-11-16 Thread Bang Rudi
LINK WEBSITE GACOR RTP 99%, FREE BET 10K DOWNLOAD APK NYA SEKARANG JUGA !!! KLAIM DI LINK DI BAWAH INI  https://heyboy.link/googleedi https://heyboy.link/googleedi https://heyboy.link/googleedi https://heyboy.link/googleedi https://heyboy.link/googleedi https://heyboy.link/googleedi

Re: [sqlalchemy] Composite columns and None

2023-11-15 Thread Mike Bayer
On Tue, Nov 14, 2023, at 6:02 PM, jens.t...@gmail.com wrote: > Hello everyone, > > I wanted to follow up on the examples on Composite Column Types > and in particular > setting the mapped composite value in Python-land to *None*. > >

[sqlalchemy] Re: Composite columns and None

2023-11-14 Thread jens.t...@gmail.com
Come to think of it, mapping to *None* doesn’t make much sense because then there’s no mapper. However, it probably would make sense to define an “invalid” mapped Point if all mapped columns are NULL. In that case, I’d still consider adding check constraints to mildly improve integrity,

[sqlalchemy] Composite columns and None

2023-11-14 Thread jens.t...@gmail.com
Hello everyone, I wanted to follow up on the examples on Composite Column Types and in particular setting the mapped composite value in Python-land to *None*. For instance, this class @dataclasses.dataclass class Point: x: int y:

[sqlalchemy] Re: DAFTAR LINK ALTERNATIF PETIRTOTO SITUS SLOT ONLINE PALING GACOR DAN TERPERCAYA

2023-11-12 Thread yunita mulyani
Link daftar permai4d : https://tinyurl.com/3a7br56d Link daftar slot gacor permai4d: https://tinyurl.com/5atrpfbb Link alternatif slot gacor permai4d : https://tinyurl.com/56m9tc5w slot gacor link daftar : https://tinyurl.com/2txh3zcn slot gacor link login : https://tinyurl.com/5atrpfbb slot

[sqlalchemy] Issue with cascade deletion

2023-11-10 Thread Javier Uribe
Hi, so I have the database classes as follows: class Thing(Base): DatasetId = Column(ForeignKey(schema + 'Dataset.DatasetId'), primary_key=True, nullable=False, index=True) RequiredThing_child = relationship('RequiredThing', cascade='all, delete-orphan') class Location(Base): DatasetId =

[sqlalchemy] Issue with cascade deletion for multiple tables

2023-11-10 Thread Javier Uribe
Hi, so I have the database classes as follows: class Thing(Base): DatasetId = Column(ForeignKey(schema + 'Dataset.DatasetId'), primary_key=True, nullable=False, index=True) RequiredThing_child = relationship('RequiredThing', cascade='all, delete-orphan') class Location(Base): DatasetId =

[sqlalchemy] Re: sqlacodegen --noclaases depracated?

2023-11-09 Thread Jonathan Vanasco
sqlacodegen is a third party tool. Your best option for support is on their Github page: https://github.com/agronholm/sqlacodegen/discussions/categories/q-a On Monday, October 23, 2023 at 2:38:15 PM UTC-4 peter.dani...@gmail.com wrote: > SQLAlchemy and sqlacodegen noob here. I'd like to

Re: [sqlalchemy] sqlalchemy 2.0 and ABCMeta

2023-11-09 Thread Mike Bayer
hi - I'm not sure what the issue is but if you are tinkering with metaclasses, we first off have an alternate version of DeclarativeBase called DeclarativeBaseNoMeta that has no metaclass installed, and may be a better place to build off custom metaclass solutions as you wont need to be

[sqlalchemy] sqlalchemy 2.0 and ABCMeta

2023-11-09 Thread 'Iwan Vosloo' via sqlalchemy
Hi there, We are migrating our code from SqlAlchemy 1.4 to 2.0 (2.0.23 to be specific). We have had the following, which allowed some classes inheriting from our Base to use an ABCMeta metaclass: --- class DeclarativeABCMeta(DeclarativeMeta,

Re: [sqlalchemy] Issue with type signature of DBAPI Connection

2023-11-07 Thread Mike Bayer
there does seem to be an extra Sequence on the outside that should be removed, please open an issue. On Tue, Nov 7, 2023, at 9:46 PM, William Hakim wrote: > I was recently using the DBAPI Cursor, and it seems to me that the type > signature of the `executemany()` function is incorrect: > >

[sqlalchemy] Issue with type signature of DBAPI Connection

2023-11-07 Thread William Hakim
I was recently using the DBAPI Cursor, and it seems to me that the type signature of the `executemany()` function is incorrect: https://github.com/sqlalchemy/sqlalchemy/blob/main/lib/sqlalchemy/engine/interfaces.py#L194 The given type signature for the second argument to `executemany()` is `

Re: [sqlalchemy] Connection issue with URL-encoded passwords in `do-connect` event

2023-11-04 Thread SeJun Bae
Yes, it does. Thank you for the explanation. On Saturday, November 4, 2023 at 1:09:32 AM UTC-7 Mike Bayer wrote: > > > On Fri, Nov 3, 2023, at 7:41 PM, SeJun Bae wrote: > > Hello everyone, > I have encountered an odd behavior when using URL-encoded tokens as > passwords for connections with

Re: [sqlalchemy] Connection issue with URL-encoded passwords in `do-connect` event

2023-11-04 Thread Mike Bayer
On Fri, Nov 3, 2023, at 7:41 PM, SeJun Bae wrote: > Hello everyone, > I have encountered an odd behavior when using URL-encoded tokens as passwords > for connections with Postgres; my application connects to a Postgres AWS RDS > instance using a token that expires (IAM Authentication >

[sqlalchemy] Connection issue with URL-encoded passwords in `do-connect` event

2023-11-03 Thread SeJun Bae
Hello everyone, I have encountered an odd behavior when using URL-encoded tokens as passwords for connections with Postgres; my application connects to a Postgres AWS RDS instance using a token that expires (IAM Authentication

Re: [sqlalchemy] Issuing Raw SQL and Returning a List of Objects

2023-11-02 Thread Mike Graziano
Hi there, This is great. Thanks for adding to the discussion. Rgds mjg On Thursday, November 2, 2023 at 11:13:07 AM UTC-4 mkmo...@gmail.com wrote: > Hi Mike, > > If I understand correctly, you want to work with raw sql and don't want > any ORM getting in your way. I'm the same way, and it

Re: [sqlalchemy] Postgresq Execute Many with Textual SQL Convenience Issue

2023-11-02 Thread Mike Bayer
On Thu, Nov 2, 2023, at 11:24 AM, mkmo...@gmail.com wrote: > Hi Mike, > > When using Core, we can do a bulk insert and bulk return with Postgresql > trivially: > > from sqlalchemy import table, column > t = table('foo', column('id'), column('bar') > > ins =

[sqlalchemy] Postgresq Execute Many with Textual SQL Convenience Issue

2023-11-02 Thread mkmo...@gmail.com
Hi Mike, When using Core, we can do a bulk insert and bulk return with Postgresql trivially: from sqlalchemy import table, column t = table('foo', column('id'), column('bar') ins = t.insert().values([{'bar': 'a'}, {'bar': 'b'}]).returning(foo.id) results = conn.execute(ins)

Re: [sqlalchemy] Issuing Raw SQL and Returning a List of Objects

2023-11-02 Thread mkmo...@gmail.com
Hi Mike, If I understand correctly, you want to work with raw sql and don't want any ORM getting in your way. I'm the same way, and it is trivial to use SQLAlchemy Core for this purpose. results = conn.execute(text('select foo, bar from baz')).mappings().fetchall() # mappings().fetchall()

[sqlalchemy] DAFTAR LINK ALTERNATIF PETIRTOTO SITUS SLOT ONLINE PALING GACOR DAN TERPERCAYA

2023-11-02 Thread ayu lestari
DAFTAR LINK ALTERNATIF PETIRTOTO SITUS SLOT ONLINE PALING GACOR DAN TERPERCAYA LINK LOGIN PETIRTOTO : https://heylink.me/Petirtoto.com/ LINK DAFTAR PETIRTOTO : https://heylink.me/Petirtoto.com/ LINK AKUN GACOR : https://heylink.me/Petirtoto.com/ LINK AKUN VIP : https://heylink.me/Petirtoto.com/

[sqlalchemy] DAFTAR LINK ALTERNATIF PETIRTOTO SITUS SLOT ONLINE PALING GACOR DAN TERPERCAYA

2023-11-02 Thread ayu lestari
DAFTAR LINK ALTERNATIF PETIRTOTO SITUS SLOT ONLINE PALING GACOR DAN TERPERCAYA LINK LOGIN PETIRTOTO : https://heylink.me/Petirtoto.com/ LINK DAFTAR PETIRTOTO : https://heylink.me/Petirtoto.com/ LINK AKUN GACOR : https://heylink.me/Petirtoto.com/ LINK AKUN VIP : https://heylink.me/Petirtoto.com/

[sqlalchemy] ✅TOTOJITU, ✅DAFTAR TOTOJITU, ✅SITUS TOTOJITU, ✅LINK TOTOJITU

2023-11-02 Thread Dharmawan Luis
LINK LOGIN TOTOJITU: https://heylink.me/totojitu1/ LINK DAFTAR TOTOJITU: https://heylink.me/totojitu1/ DAFTAR LINK TOTOJITU LINK GACOR TOTOJITU LINK DEPOSIT TOTOJITU LINK DAFTAR TOTOJITU LINK ALTERNATIF TOTOJITU LINK SLOT GACOR LINK SLOT THAILAND LINK SLOT PULSA LINK SLOT DEPO 10K

[sqlalchemy] TOTOJITU SITUS TOGEL AMAN TERPERCAYA | TOTOJITU SITUS TERBESAR NO.1 DI INDONESIA

2023-10-30 Thread Dharmawan Luis
TOTOJITU SITUS TOGEL AMAN TERPERCAYA | TOTOJITU SITUS TERBESAR NO.1 DI INDONESIA  Link Login ❱❱ https://heylink.me/totojitu1/  Klik Disini Daftar Togel dan Slot Gacor ❱❱ https://heylink.me/totojitu1/  Klik Disini Daftar Bonus New Member ❱❱ https://heylink.me/totojitu1/  Klik Disini Daftar

Re: [sqlalchemy] How correct sort items by @hibrid_property

2023-10-30 Thread Simon King
The error you're getting doesn't have anything to do with using the property in an order_by. It's being triggered just by accessing "Product.Rating". WIth hybrid properties, when you access them via the class as you've done here, the "self" parameter is set to the Product class itself. So on the

[sqlalchemy] How correct sort items by @hibrid_property

2023-10-29 Thread Nik
Hello, guys! I have a simple code, which not correct work He throw error if i try sort items by @hybrid_property *My version of entity class:* class Product(Base) : __tablename__ = 'products' Id = Column('id', Integer, primary_key=True, autoincrement=True) TitleTranslit =

[sqlalchemy] sqlacodegen --noclaases depracated?

2023-10-23 Thread Peter Daniels
SQLAlchemy and sqlacodegen noob here. I'd like to just get some simple SQLAlchemy tables generated for my database. I tried using --noclasses, but it doesn't seem to recognize the option. sqlacodegen --noclasses mysql+pymysql://root:@localhost:3306/mydb sqlacodegen: error: unrecognized

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-22 Thread Mike Bayer
great, glad to know that new API is finding itself useful. On Sun, Oct 22, 2023, at 9:32 PM, 'Tony Cosentini' via sqlalchemy wrote: > do_orm_execute() (and freezing the results) totally allows for what I'm > trying to do! Also I forgot to mention earlier, but this is only going to run > in

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-22 Thread 'Tony Cosentini' via sqlalchemy
do_orm_execute() (and freezing the results) totally allows for what I'm trying to do! Also I forgot to mention earlier, but this is only going to run in tests. Thanks again for all the help, Tony On Friday, October 20, 2023 at 11:10:23 PM UTC+8 Mike Bayer wrote: > > > On Fri, Oct 20, 2023, at

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread Mike Bayer
On Fri, Oct 20, 2023, at 10:46 AM, 'Tony Cosentini' via sqlalchemy wrote: > Oh I see, thanks for clarifying. > > I'm trying to detect cases where we depend on the autoflush behavior. For > example, in the sample above, when the query runs with no_autoflush, we won't > get back any results

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread 'Tony Cosentini' via sqlalchemy
Oh I see, thanks for clarifying. I'm trying to detect cases where we depend on the autoflush behavior. For example, in the sample above, when the query runs with no_autoflush, we won't get back any results (when previously we would get back one row). It's a fairly large codebase, so I was trying

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread Mike Bayer
On Fri, Oct 20, 2023, at 9:50 AM, 'Tony Cosentini' via sqlalchemy wrote: > Weird, I did try that but I can't seem to trigger it. > > Here's a self-contained test: > https://gist.github.com/tonycosentini/4dee3478695d032ca67707b5e26739b6 the object was not affected in that query (that is, not

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread 'Tony Cosentini' via sqlalchemy
Weird, I did try that but I can't seem to trigger it. Here's a self-contained test: https://gist.github.com/tonycosentini/4dee3478695d032ca67707b5e26739b6 I have the event listener set to just crash, but it never triggers. On Fri, Oct 20, 2023 at 9:20 PM Mike Bayer <

Re: [sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread Mike Bayer
On Fri, Oct 20, 2023, at 8:08 AM, 'Tony Cosentini' via sqlalchemy wrote: > Hi, > > Is there any way to listen for an event for when a query result gets merged > into a pre-existing object in the session? this is the refresh event:

[sqlalchemy] Event listener for when query results get matched with pre-existing objects on the session

2023-10-20 Thread 'Tony Cosentini' via sqlalchemy
Hi, Is there any way to listen for an event for when a query result gets merged into a pre-existing object in the session? I'm working on disabling autoflush for some of our codebase (mostly to cut down on queries on a high QPS path), but before doing that I want to write a utility to detect

[sqlalchemy] ดูบอล8888 -ดาวน์โหลด 918kiss เวอร์ชั่น ล่าสุด ios

2023-10-18 Thread Dulles Cornelius
ดาวน์โหลด 918kiss เวอร์ชั่นล่าสุด iOS ถ้าคุณเป็นคนที่ชอบเล่นสล็อตออนไลน์ และกำลังมองหาเว็บไซต์ที่ให้บริการตลอด 24 ชั่วโมง พร้อมกับสล็อตที่แจกเครดิตฟรี แล้วบางทีก็เปิดให้เล่นบน iOS ล่าสุดของคุณ คุณควรพิจารณาดาวน์โหลด 918kiss เวอร์ชั่นล่าสุด iOS

[sqlalchemy] 1

2023-10-18 Thread Dulles Cornelius
1 -- 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

Re: [sqlalchemy] How to use IBM i Access ODBC Driver

2023-10-11 Thread Jack W.
Mike -- I found *sqlalchemy-ibmi *which connects but doesn't work all the way because it's aimed at SQLAlchemy 1.3.x. I'm trying Apache Superset which wants SQLAlchemy>=1.4.49. I've filed an issue Apache Superset requires SQLAlchemy 1.4.x

Re: [sqlalchemy] How to use IBM i Access ODBC Driver

2023-10-11 Thread Jack W.
Thanks for the prompt response, Michael ... On Wednesday, October 11, 2023 at 7:01:47 AM UTC-6 Mike Bayer wrote: SQLAlchemy does not include support for this driver - the only IBM driver is the ibm_db_sa you reference, so short of writing your own driver based on that one, that's what's

Re: [sqlalchemy] Batch patch ORM entities

2023-10-11 Thread Pierre Massé
Thanks a lot, sorry to have been a bother for such a simple question.. Le mer. 11 oct. 2023 à 17:16, Mike Bayer < mike_not_on_goo...@zzzcomputing.com> a écrit : > > > On Wed, Oct 11, 2023, at 11:10 AM, Pierre Massé wrote: > > Thanks a lot for the insight Mike, > > My question might then be quite

Re: [sqlalchemy] Batch patch ORM entities

2023-10-11 Thread Mike Bayer
On Wed, Oct 11, 2023, at 11:10 AM, Pierre Massé wrote: > Thanks a lot for the insight Mike, > > My question might then be quite naive: let's say I have a list of ORM > entities on one side, and an accordingly sorted numpy array of computed > features, how would I merge back attributes on

Re: [sqlalchemy] Batch patch ORM entities

2023-10-11 Thread Pierre Massé
Thanks a lot for the insight Mike, My question might then be quite naive: let's say I have a list of ORM entities on one side, and an accordingly sorted numpy array of computed features, how would I merge back attributes on entities? Let's say I have a list like : user_list = [User(id=1,

Re: [sqlalchemy] Batch patch ORM entities

2023-10-11 Thread Mike Bayer
On Wed, Oct 11, 2023, at 4:22 AM, Pierre Massé wrote: > Dear all, > > I have a requirement that makes me think that I need to "mass patch" some ORM > objects. However, I am open to any suggestions regarding the way to answer my > requirements. > > I have defined an ORM object which

Re: [sqlalchemy] How to use IBM i Access ODBC Driver

2023-10-11 Thread Mike Bayer
SQLAlchemy does not include support for this driver - the only IBM driver is the ibm_db_sa you reference, so short of writing your own driver based on that one, that's what's available. On Tue, Oct 10, 2023, at 11:07 PM, Jack W. wrote: > I have the IBM i Access ODBC Driver >

Re: [sqlalchemy] why does sqlalchemy UUID succeed with mysql BINARY(16) but fails with postgres BYTEA

2023-10-11 Thread Mike Bayer
PostgreSQL has a native UUID datatype, so when you use SQLAlchemy's UUID, it maps to a real PG UUID datatype, not BYTEA. as for sqlalchemy_utils.UUIDType, we dont maintain that package here so you'd need to look at their source code. Overall if you want complete "UUID mapped to any arbitrary

[sqlalchemy] Batch patch ORM entities

2023-10-11 Thread Pierre Massé
Dear all, I have a requirement that makes me think that I need to "mass patch" some ORM objects. However, I am open to any suggestions regarding the way to answer my requirements. I have defined an ORM object which represents a user, holding longitude and latitude (among other attributes). At

[sqlalchemy] How to use IBM i Access ODBC Driver

2023-10-10 Thread Jack W.
I have the IBM i Access ODBC Driver installed on Linux and I'm trying out Apache Superset. The SQLAlchemy URIs I create don't work, e.g., - iaccess+pyodbc://x driver not found - All the

[sqlalchemy] why does sqlalchemy UUID succeed with mysql BINARY(16) but fails with postgres BYTEA

2023-10-10 Thread Sam S
I noticed that mysql's BINARY(16) datatype can get read into sqlalchemy's UUID() no problem, but if it is postgres' BYTEA datatype, then it fails. I created a reproducible example at this gist: https://gist.github.com/sss-ng/1283c85d1010264132985156c148439b If someone could help me, I would

Re: [sqlalchemy] Difference b/w creating a DeclarativeBase class vs assigning DeclarativeBase()

2023-10-10 Thread Simon King
I don't think this code was ever correct: Base = DeclarativeBase() Before SQLAlchemy 2.0, there was a declarative_base() function that was used in the same way: from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() ...but in SQLAlchemy 2.0, the

[sqlalchemy] 1

2023-10-10 Thread Melville Mildred
1 -- 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

[sqlalchemy] Difference b/w creating a DeclarativeBase class vs assigning DeclarativeBase()

2023-10-10 Thread satya dev
What is the difference between class Base(DeclarativeBase): pass vs Base = DeclarativeBase() I am following the SQLAlchemy Tutorial for declaring mapped classes when I inherit the Base class I can access the metadata and create my tables

[sqlalchemy] TypeError:unexpected keyword argument 'hash'

2023-10-03 Thread Albert A
Hi All, I am trying to push a result file using below robotframework(python) command to a Mysql db and getting below error. Command used: python -m dbbot.run -b mysql://username:pass@localhost/robot_results output.xml where dbname - robot_results filename - output.xml Getting error as below

Re: [sqlalchemy] sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'uuid_utils.UUID'

2023-10-02 Thread Mike Bayer
I havent read about uuid 7, however if it takes up the same number of bytes as other UUIDs, this "uuid_utils" should really be returning Python UUID objects and not something ad-hoc, that's the source of the incompatibility here. otherwise, you'd need to build a custom type, see

[sqlalchemy] sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'uuid_utils.UUID'

2023-10-02 Thread Zer0x00
I want to use UUID v7 with this package: https://github.com/aminalaee/uuid-utils/ Here's my current code: from sqlalchemy.dialects.postgresql import UUID as POSTGRES_UUID from sqlalchemy.orm import Mapped, as_declarative, mapped_column from uuid_utils import UUID, uuid7 from db.dependencies

Re: [sqlalchemy] Issue DELETE statement with LIMIT

2023-09-22 Thread Mike Bayer
I thought we have a github for DELETE..LIMIT but we dont. This would be a construct specific to the MySQL dialect: from sqlalchemy.dialects.mysql import delete , where it would include order_by() and limit() params.We don't have internal resources to carry this through so we'd rely upon

Re: [sqlalchemy] Issue DELETE statement with LIMIT

2023-09-22 Thread Warwick Prince
Hi.  Can you do a sub query with the ones you want to delete selected (with limit) and then delete with an IN clause on the sub query items?Warwick A. PrinceMushroom Systems International Pty. Ltd.On 22 Sep 2023, at 9:16 pm, 'Grennith' via sqlalchemy wrote:Hi everyone,I'd like to issue a LIMIT

[sqlalchemy] Issue DELETE statement with LIMIT

2023-09-22 Thread 'Grennith' via sqlalchemy
Hi everyone, I'd like to issue a LIMIT for a DELETE statement. By default, this is not possible as far as I can see it. The function limit() is available for SELECT in general however. Searching through documentation, I found a reference to with_dialect_option():

[sqlalchemy] Re: Duplicate entry '0' for key 'PRIMARY'

2023-09-21 Thread Martin Parrag
Hi All! Crisis reverted, turned out my database column didn't have the autoincerement flag. Sorry for the topic. Martin Parrag a következőt írta (2023. szeptember 21., csütörtök, 16:53:14 UTC+2): > Hi Guys! > > I have ORMs with autoincrement primary keys, and I'd like to achive a > multiple

[sqlalchemy] Duplicate entry '0' for key 'PRIMARY'

2023-09-21 Thread Martin Parrag
Hi Guys! I have ORMs with autoincrement primary keys, and I'd like to achive a multiple insert with sqlalchemy. I'm making a lot of objects and adding them to the session, and after I'm done, I'd like to make session.commit() but then I get this error: (MySQLdb.IntegrityError) (1062,

Re: [sqlalchemy] Event: do_orm_execute inserted value

2023-09-20 Thread Tomas Pavlovsky
Thank you. środa, 20 września 2023 o 15:54:42 UTC+2 Mike Bayer napisał(a): > for a statement like that where the values are embedded in the insert() > construct directly you would use: > > orm_execute_state.statement.compile().params > > this is mentioned in the tutorial at >

Re: [sqlalchemy] Event: do_orm_execute inserted value

2023-09-20 Thread Mike Bayer
for a statement like that where the values are embedded in the insert() construct directly you would use: orm_execute_state.statement.compile().params this is mentioned in the tutorial at https://docs.sqlalchemy.org/en/20/tutorial/data_insert.html#the-insert-sql-expression-construct

[sqlalchemy] Event: do_orm_execute inserted value

2023-09-20 Thread Tomas Pavlovsky
Hi Mike, how to access inserted value in do_orm_execute? Event "before_insert" has "target" parameter, but how to do it in do_orm_execute? session.execute(insert(User).values(name="name")) I need to access name value but don't know how? Thanks -- SQLAlchemy - The Python SQL Toolkit and

Re: [sqlalchemy] Temporarily disable/intercept ORM events on mutation

2023-09-15 Thread Mike Bayer
On Fri, Sep 15, 2023, at 8:59 PM, Mike Bayer wrote: > > unfortunately no, that's a backref event handler, that's within the class > instrumentation and has no mechanism to be disabled on a per-class basis, not > to mention the backref handler is not the only aspect of things that expects > a

Re: [sqlalchemy] Temporarily disable/intercept ORM events on mutation

2023-09-15 Thread Mike Bayer
On Fri, Sep 15, 2023, at 4:28 PM, 'Luna Lucadou' via sqlalchemy wrote: > When customers call our JSON:API API, they can use an "include" parameter to > specify related objects to be appended to the response. > > However, requests to include are not always satisfiable (e.g. if >

[sqlalchemy] Temporarily disable/intercept ORM events on mutation

2023-09-15 Thread 'Luna Lucadou' via sqlalchemy
When customers call our JSON:API API, they can use an "include" parameter to specify related objects to be appended to the response. However, requests to include are not always satisfiable (e.g. if job.supervisor=null, include=supervisor is ignored). In order to prevent Marshmallow from trying

Re: [sqlalchemy] How to combine statement eager loading with polymorphic relations

2023-09-15 Thread Mike Bayer
the recursion_depth feature on selectinload() is also very new and that is actually a very complex and not very mature feature.If you only wanted to apply additional options for N levels deep, you would build out separate options for that, like: options( selectinload(Model.thing,

Re: [sqlalchemy] How to combine statement eager loading with polymorphic relations

2023-09-15 Thread Cornelis Poppema
Hello Mike, thank you very much for the in-depth reply and providing a solution :) There is no specific reason that I posted in google groups, I did not visit the support page, this was just something I decided after thinking where to post first between googlegroups and stackoverflow, I will

Re: [sqlalchemy] How to combine statement eager loading with polymorphic relations

2023-09-14 Thread Mike Bayer
working on that issue but you should also be able to do this right now: .options( selectinload(StepModel.actionbases.of_type(ServiceActionModel)).selectinload(ServiceActionModel.service), raiseload("*"), ) that produces more of a LEFT OUTER JOIN with a subquery situation but still

Re: [sqlalchemy] sqlalchemy.orm.exc.FlushError on subclass

2023-09-14 Thread 'Luna Lucadou' via sqlalchemy
Thanks. We went with the helper class route, and it seems to be working much better than attempting to use inheritance in a manner that seems unsupported. On Wednesday, September 6, 2023 at 1:24:04 PM UTC-5 Mike Bayer wrote: > if you can't correct this model to apply the persistence details to

Re: [sqlalchemy] How to combine statement eager loading with polymorphic relations

2023-09-14 Thread Mike Bayer
On Thu, Sep 14, 2023, at 7:36 AM, Cornelis Poppema wrote: > Hi all, > > I am new to sqlalchemy, I think the idea of what I am trying to achieve is > relatively simple, but I can't seem to figure out how to retrieve `.service` > in the same query. I failed to find an example in the 2.0

[sqlalchemy] How to combine statement eager loading with polymorphic relations

2023-09-14 Thread Cornelis Poppema
Hi all, I am struggling to combine a joinedload (or selectinload, whatever works) with the submodels of selectin_polymorphic. I have a model "step" that has a collections of "actions" that are relevant when my application reaches that step. These actions can be anything and also have their

Re: [sqlalchemy] Unique constraint error in PostgrSQL when migrating with Alembic

2023-09-13 Thread Mike Bayer
your revisions table has a composite unique constraint - one constraint with two columns in it. therefore to refer to this constraint via foreign key, you need a single composite foreignkeyconstraint - again, one constraint that links two columns together. you would use ForeignKeyConstraint

[sqlalchemy] Unique constraint error in PostgrSQL when migrating with Alembic

2023-09-13 Thread Lord Wolfenstein
I have a database that looks like this that I create with Alembic. The relationships are trivial except between Revision and ObjectCount, there it used two foreign keys [image: aaa.png] The code looks like this from datetime import datetime from typing import

Re: [sqlalchemy] Doesnt execute any thing at new pc

2023-09-12 Thread Richard Damon
On 9/12/23 12:31 AM, FURKAN bilgin wrote: Hi, I updated my PC and downloaded my old codes. However, the SQLAlchemy execute function is not working. but it works on Ubuntu. The code is basically like this: My first suggestion is to make sure the directory path points to something that actually

[sqlalchemy] Doesnt execute any thing at new pc

2023-09-12 Thread FURKAN bilgin
Hi, I updated my PC and downloaded my old codes. However, the SQLAlchemy execute function is not working. but it works on Ubuntu. The code is basically like this: -- from sqlalchemy import ( MetaData, Table, Column, Integer, String, Boolean, create_engine, DateTime,

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Mike Bayer
makes sense, the connection is pooled. if you make lots of connections, like more than five simultaneous connections, you'd see more of it, if you call engine.dispose() then engine.connect(), you would see it again also, etc. Also try using NullPool, then you'd see the hook run every time

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Steven Schierholz
Yes but only once when the app starts up. On Friday, September 8, 2023 at 10:04:45 AM UTC-6 Mike Bayer wrote: > assuming proper indentation it looks fine. are your print statements > being seen ? > > On Fri, Sep 8, 2023, at 11:54 AM, Steven Schierholz wrote: > > Ok that makes sense and

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Mike Bayer
assuming proper indentation it looks fine. are your print statements being seen ? On Fri, Sep 8, 2023, at 11:54 AM, Steven Schierholz wrote: > Ok that makes sense and clarifies some stuff for me. I have tried your > implementation but it doesn't seem like its getting new connections. We are >

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Steven Schierholz
Ok that makes sense and clarifies some stuff for me. I have tried your implementation but it doesn't seem like its getting new connections. We are using sessionmaker(). So basically this is what we are doing. Can you help me understand if we are doing this right and if any changes need to

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Mike Bayer
no, create_engine() does not connect at all. connections occur when you first call `engine.connect()`. From that point, the behavior of subsequent `engine.connect()` calls depends on connection pool configuration. all connection pools have points at which they continue to establish new

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Steven Schierholz
That makes sense but doesn't connect only happen once when create_engine() is called? On Thursday, September 7, 2023 at 12:00:35 PM UTC-6 Mike Bayer wrote: > the documentation for this pattern is at > https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Steven Schierholz
That makes sense but doesn't connect only happen once when create_engine() is called? On Thursday, September 7, 2023 at 12:00:35 PM UTC-6 Mike Bayer wrote: > the documentation for this pattern is at > https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Mike Bayer
the documentation for this pattern is at https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens , and a completely specific example is at https://docs.sqlalchemy.org/en/20/dialects/mssql.html#mssql-pyodbc-access-tokens . Basically your application needs

[sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Steven Schierholz
So I have seen some chats here about cred refresh from vault and some suggestions have been to use @event.listens_for(engine, "do_connect") to update creds when the connection is established. My understanding of this is that connecting to the database should only happen once when my flask

Re: [sqlalchemy] Duplicating a relationship from one ORM model to a subquery model

2023-09-07 Thread Mike Bayer
send viewonly=True to these relationships you make. these are not for writing anyway and that will resolve the overlaps warnings (the warning says as much). On Thu, Sep 7, 2023, at 10:41 AM, zedr...@gmail.com wrote: > Hi Mike, > > Thanks a lot for taking the time to reply… > > Indeed, I came

Re: [sqlalchemy] Duplicating a relationship from one ORM model to a subquery model

2023-09-07 Thread zedr...@gmail.com
Hi Mike, Thanks a lot for taking the time to reply… Indeed, I came to a similar conclusion and worked out what seems like a fairly clean way to copy relationships (assuming they do not use secondary_join). The fact that I cannot seem to update the mapper before the class is created makes my

Re: [sqlalchemy] Duplicating a relationship from one ORM model to a subquery model

2023-09-07 Thread Mike Bayer
On Thu, Sep 7, 2023, at 4:39 AM, zedr...@gmail.com wrote: > > *Is there a clean way to (programmatically) duplicate all relationship from > an existing model, over to a new model (that targets the same table and > selects a subset of columns as a subquery)?* relatonships are fixed to their

[sqlalchemy] Duplicating a relationship from one ORM model to a subquery model

2023-09-07 Thread zedr...@gmail.com
I am trying to (programmatically) create partial views of existing SQLAlchemy models, using a metaclass. A streamlined example, trying to get a subquery view on a model Foo with a relationship bar, would look something like that: class Bar(db.Model): id = db.Column(db.Integer,

  1   2   3   4   5   6   7   8   9   10   >