Re: [sqlalchemy] How can I use bulk_save_objects when I know the primary key?

2020-03-12 Thread Mike Bayer
On Thu, Mar 12, 2020, at 9:51 PM, James Fennell wrote: > Hey all! I'm having a problem using the bulk_save_objects function. > ** > *Background*: I'm working on an application that updates state in a database > from an external feed. The process is: I read the feed, convert the data into >

Re: [sqlalchemy] How do I use unnest and select using the Query API?

2020-03-12 Thread Mike Bayer
unnest is a fancy thing that isn't easily supported by SQLAlchemy right now. there's a recipe at https://github.com/sqlalchemy/sqlalchemy/issues/3566#issuecomment-441931333 which hopefully is still in working order, you'd have to work with that for now. On Thu, Mar 12, 2020, at 8:31 PM, Shyam

[sqlalchemy] How can I use bulk_save_objects when I know the primary key?

2020-03-12 Thread James Fennell
Hey all! I'm having a problem using the bulk_save_objects function. *Background*: I'm working on an application that updates state in a database from an external feed. The process is: I read the feed, convert the data into SQLAlchemy objects which are detached from the session and then call

[sqlalchemy] How do I use unnest and select using the Query API?

2020-03-12 Thread Shyam Sunder
Probably a simple question, but I am unable to translate the SQL to Query API function calls. I'm using PostgreSQL 11 and SQLAlchemy 1.3. The raw SQL query I want to translate is this: SELECT s.post_id, s.signature, count(a.query) AS score FROM post_signature AS s, unnest(s.words, $1) AS