python-gino / gino

GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
https://python-gino.org/
Other
2.68k stars 150 forks source link

Answering "How to do bulk insert / update?" #690

Closed austincollinpena closed 4 years ago

austincollinpena commented 4 years ago

I came across this conversation talking about bulk insertion. I found the FAQ to have a question corresponding to the discussion with no answer.

I took wwwjfy's comment, gave it some context, and added it to the FAQ.

Before considering this pull request, perhaps it would be wiser to examine this implementation by Arthur264 as another example:

await insert(model.__table__).values(items).on_conflict_do_nothing().gino.scalar()
fantix commented 4 years ago

Thank you so much for this PR! I'm reviewing a bit later this weekend.

austincollinpena commented 4 years ago

Happy to help! I love the library and I hope to make as many small contributions as I can. If you have feedback for me it's always appreciated.

fantix commented 4 years ago

I'm glad to hear that. Yes, an example of bulk update would be great - bulk upsert is another bonus.

roycefanproxy commented 3 years ago

Hi, does this method returns all the inserted data?