Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-26 Thread Mike Bayer
On Thu, Nov 26, 2020, at 5:05 PM, Kata Char wrote: > Is the documentation up-to-date? yup > > > > I printed out a query and there were two insert statements, but the > documentation shows one - am I doing something wrong? > I see in the postgresql logs two insert statements > LOG:

Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-26 Thread Kata Char
Is the documentation up-to-date? I printed out a query and there were two insert statements, but the documentation shows one - am I doing something wrong? class Foo(db.Model): id = db.Column(db.BigInteger, primary_key=True, autoincrement=True) test = db.Column(db.String(80),

Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-25 Thread Mike Bayer
technically Table and TableClause are a little bit different but I don't think there's any behavioral difference at the level of execute(obj.insert()). what matters more is if the Column objects have datatypes or defaults that incur some kind of Python-side processing or not. On Wed, Nov 25,

Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-25 Thread 'Jonathan Vanasco' via sqlalchemy
This was not clear enough in Mike's post: `Foo.__table__` is the same type of object as `_foo = table(...)`. SQLAlchemy ORM is built on top of SQLAlchemy's Core, so the ORM's `.__table__` attribute is the Core's `table()` object. Since they're the same, the two will have the same performance

Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-25 Thread Kata Char
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(), [{...},

Re: [sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-25 Thread Mike Bayer
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 > > - >

[sqlalchemy] Differences between TableClause insert and Model.__table__ inserts?

2020-11-25 Thread Kata Char
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