I see, does that mean there is no difference in performance if one or the other is used? In other words from sqlalchemy.sql import table
_foo = table(...) conn.execute(_foo.insert(), [{...}, ...]) Would have the same performance as `conn.execute(Foo.__table__.insert(), [{...}, ...])` On Wednesday, November 25, 2020 at 8:27:53 AM UTC-8 Mike Bayer wrote: > > > On Wed, Nov 25, 2020, at 10:30 AM, Kata Char wrote: > > Hi, sorry if this post is a duplicate, my first one didn't seem to make it. > > I was reading the documentation: > - https://docs.sqlalchemy.org/en/13/core/tutorial.html#execute-multiple > > - > https://docs.sqlalchemy.org/en/13/_modules/examples/performance/bulk_inserts.html > > Is there any difference between conn.execute(TableClause.insert(), [...]) > vs conn.execute(Model.__table__.insert(), [...])? > > The first one is documented to use execumany(), but what about the second > one? > > > Any conn.execute() that passes a list of dictionaries as the second > argument, where there is more than one entry in the list, will use the > executemany() style with the DBAPI connection. > > With the ORM the Model.__table__ attribute is a Table object. That > tutorial seems to be referencing TableClause which is the base class for > Table, but all the examples there are using Table objects. > > > > -- > 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+...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/1ffe48c6-4124-40ab-902f-ffa86885ea94n%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/1ffe48c6-4124-40ab-902f-ffa86885ea94n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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/ea6c2037-613c-4ebf-a4d3-e6fba46cf743n%40googlegroups.com.