Hi,
What is the most efficient way to insert several records into a table which
has a fk ref to the auto incrementing pk of another insert I need to do in the
same statement.

I am migrating some code away from using the SQLAlchemy orm to using the
Core. The way the data is returned to me is a string (requiring an insert into 
table A)
accompanied by several more strings (requiring inserts into table B with a ref 
to a pk
in table A's row).

So instead of doing this the typical way, if I can prepare all the sql as one 
large
statement for several sets of related inserts (The initial insert into table A 
with all
the related inserts into table B) I will get the performance I am after.

Does this seem reasonable? Sqlite doesn't support variable declaration but I am
sure there is a more efficient means to this using something along the lines of
INSERT INTO SELECT, just not sure how to craft this with "n" inserts based on 
one
select from the PK generating initial insert.

Thanks,
jlc
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to