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] 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()

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

2023-08-24 Thread Mike Graziano
Hi Simon, Thanks for responding to my post. It turns out that MyBatis can do exactly what you are saying which essentially sounds like a bulk ETL process. Again, the key difference is that MyBatis doesn’t require that the mapping be done with all the DB-specific definitions which I

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

2023-08-23 Thread Simon King
My perspective: the SQLAlchemy ORM really comes into its own when you are making use of its Unit of Work system to load a batch of objects from the database, manipulate those objects, and then flush your changes back to the database. If you are only *loading* data then you don't need a lot of the

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

2023-08-21 Thread Mike Graziano
Hi Mike, Thanks for that info. It was just what I needed. I also want to thank you for your YouTube tutorials on SQLAlchemy. They are fantastic. I don’t want to make this a huge post, but I have a real pet peeve concerning ORMs. I come from a Java background where I used MyBatis as

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

2023-08-17 Thread Mike Bayer
the raw SQL to ORM mapping pattern has a lot of limitations but it is documented at https://docs.sqlalchemy.org/en/20/orm/queryguide/select.html#getting-orm-results-from-textual-statements . On Thu, Aug 17, 2023, at 4:26 PM, Mike Graziano wrote: > To all, > > I am new to Python and