Hello! SQLAlchemy has the (really useful) behavior of batching together
inserts when all the primary keys are defined. It looks like it groups
similar tables together (while maintaining insert order ) to minimize the
number of Insert statements sent to the database.
I'm unsure what the
>
> if you're using Postgresql, there's a vastly easier technique to use
> which is just to pre-fetch from the sequence:
> identities = [
> val for val, in session.execute(
> "select nextval('mytable_seq') from "
> "generate_series(1,%s)" % len(my_objects))
>
You were exactly right. I needed to commit.
On Monday, October 9, 2017 at 4:08:05 PM UTC-7, Mike Bayer wrote:
>
> On Mon, Oct 9, 2017 at 3:57 PM, Colton Allen > wrote:
> > I'm trying to execute a fairly simple UPDATE query.
> >
> > query =
On Mon, Oct 9, 2017 at 3:57 PM, Colton Allen wrote:
> I'm trying to execute a fairly simple UPDATE query.
>
> query = update(Model).where(Model.id.in_(list_of_ids)).values(x=1)
>
> I know of two methods to execute it. One using the session and the other
> using the engine.
Both are using postgres. But I did try updating the bind to both the
engine (db.engine) and the session (db.session) and it didn't have any
affect.
On Monday, October 9, 2017 at 2:09:02 PM UTC-7, Jonathan Vanasco wrote:
>
> OTOMH (I didn't go through your code), are the two databases the same?
OTOMH (I didn't go through your code), are the two databases the same?
If not, this is possibly related to database specific compiling (or the
lack of) and a common error. Note the `bind` references in the
docs: http://docs.sqlalchemy.org/en/latest/core/tutorial.html#executing
Depending on
I'm trying to execute a fairly simple UPDATE query.
query = update(Model).where(Model.id.in_(list_of_ids)).values(x=1)
I know of two methods to execute it. One using the session and the other
using the engine. However, depending on which I use, the results I get are
very different.
On Mon, Oct 9, 2017 at 4:15 AM, wrote:
> Hello! I've spent some time looking at SQLAlchemy's ability to batch
> inserts, and have a few questions about bulk_save_objects (and flushing in
> general).
>
> Two statements that I think are true:
>
> Right now, bulk_save_objects
On Sun, Oct 8, 2017 at 10:45 PM, Seth P wrote:
> Apologies if I missed something, but does SQLAlchemy (1.2.0?) support the new
> Postgres 10 identity keyword
> (https://blog.2ndquadrant.com/postgresql-10-identity-columns/)?
not directly, however you can intercept SERIAL and
Hello! I've spent some time looking at SQLAlchemy's ability to batch
inserts, and have a few questions about bulk_save_objects (and flushing in
general).
Two statements that I think are true:
1. Right now, bulk_save_objects does not fetch primary keys for inserted
rows (unless
10 matches
Mail list logo