upsert Questions
2
I have a table storing directory paths (Dirs). These directory rows are referenced by a Files table, using the directory's rowid as a foreign key. When re-indexing directories/files there is the ne...
7
I'm updating a Postgres 8.4 database (from C# code) and the basic task is simple enough: either UPDATE an existing row or INSERT a new one if one doesn't exist yet. Normally I would do this:
UPDAT...
Meagher asked 12/8, 2010 at 4:22
5
Solved
I'm using Postgres 9.5 and seeing some wired things here.
I've a cron job running ever 5 mins firing a sql statement that is adding a list of records if not existing.
INSERT INTO
sometable (cus...
Como asked 13/5, 2016 at 8:15
3
Solved
bulk_create with ignore_conflicts=True insert new records only and doesn't update existing one.
bulk_update updates only existing records and doesn't insert new one.
Now I see only one variant to...
1
I have viewed many many posts regarding this and they seem to obfusticate multiple columns, also where there should be unquoted values eg:
MySQL ON DUPLICATE KEY UPDATE for multiple rows insert in ...
6
Solved
I've scraped some data from web sources and stored it all in a pandas DataFrame. Now, in order harness the powerful db tools afforded by SQLAlchemy, I want to convert said DataFrame into a Table() ...
Stylistic asked 22/4, 2020 at 13:43
12
I have a record that I want to exist in the database if it is not there, and if it is there already (primary key exists) I want the fields to be updated to the current state. This is often called a...
Grassquit asked 23/8, 2011 at 18:46
9
Solved
This error happens when I tried to update upsert item:
Updating the path 'x' would create a conflict at 'x'
13
Solved
I want to add a row to a database table, but if a row exists with the same unique key I want to update the row.
For example:
INSERT INTO table_name (ID, NAME, AGE) VALUES(1, "A", 19);
Le...
Matrona asked 17/11, 2010 at 14:8
2
Solved
I searched a bit regarding my problem but can't find anything that really to help.
So my problem/dilema stays like this:
I know that mysql database have a unique index system that can be used for ...
Nicks asked 20/11, 2014 at 20:55
13
Solved
I have two separately unique columns in a table: col1, col2. Both have a unique index (col1 is unique and so is col2).
I need INSERT ... ON CONFLICT ... DO UPDATE syntax, and update other columns i...
Bumble asked 9/3, 2016 at 9:46
1
Solved
I'm using Mongoose .insertMany method to populate the imagesSchema with an array of objects.
Wondering how to go about using upsert:true with .insertMany() or another method to update/remove all ob...
Iceman asked 14/1, 2017 at 0:1
2
Solved
Does snowflake support updating/inserting all columns with a syntax like UPDATE * or INSERT *
MERGE INTO events
USING updates
ON events.eventId = updates.eventId
WHEN MATCHED THEN
UPDATE *
...
Diallage asked 28/5, 2021 at 21:40
21
I'm using Python to write to a postgres database:
sql_string = "INSERT INTO hundred (name,name_slug,status) VALUES ("
sql_string += hundred + ", '" + hundred_slug + "', " + status + ");"
cursor.ex...
Zeb asked 1/11, 2010 at 14:24
2
Solved
When you are upserting a row (PostgreSQL >= 9.5), and you want the possible INSERT to be exactly the same as the possible UPDATE, you can write it like this:
INSERT INTO tablename (id, username, p...
Oulu asked 1/4, 2016 at 14:52
3
Solved
The title is mostly self-explanatory. Eloquent has a method called
updateOrCreate()
documented here: https://laravel.com/docs/5.5/eloquent#other-creation-methods
In some cases this is really ...
Rim asked 25/10, 2017 at 15:25
5
Solved
I have documents that looks something like that, with a unique index on bars.name:
{ name: 'foo', bars: [ { name: 'qux', somefield: 1 } ] }
. I want to either update the sub-document where { name...
Epstein asked 5/5, 2014 at 10:49
10
Solved
I have the following UPSERT in PostgreSQL 9.5:
INSERT INTO chats ("user", "contact", "name")
VALUES ($1, $2, $3),
($2, $1, NULL)
ON CONFLICT("user", "contact") DO NOTHING
RETURNING id;
If t...
Tachograph asked 10/1, 2016 at 17:25
18
Solved
Several months ago I learned from an answer on Stack Overflow how to perform multiple updates at once in MySQL using the following syntax:
INSERT INTO table (id, field, field2) VALUES (1, A, X), (...
Hartwell asked 10/7, 2009 at 11:38
2
I need to be able to use saveAll() method of a spring data CrudRepository and ignore duplicate insertion on a unique constraint.
In my current project I'm currently using spring boot -> jpa stack ...
Optimism asked 23/8, 2019 at 8:59
8
Solved
Does ActiveRecord have a built-in upsert functionality? I know I could write it myself but I obviously don't want to if such a thing already exists.
Accusative asked 14/1, 2011 at 20:25
1
Solved
I cannot figure out how to proceed with an Upsert & "multiple" onConflict constraints. I want to push a data batch in a Supabase table.
My data array would be structured as follows:
i...
Flagellum asked 26/1, 2023 at 14:31
4
Solved
I'm inserting/updating objects into a MySQL database using the peewee ORM for Python. I have a model like this:
class Person(Model):
person_id = CharField(primary_key=True)
name = CharField()
I ...
13
Solved
Here is a simple pojo:
public class Description {
private String code;
private String name;
private String norwegian;
private String english;
}
And please see the following code to apply an ...
Cusack asked 15/11, 2013 at 12:55
3
Solved
correct syntax of upsert with postgresql 9.5, below query shows column reference "gallery_id" is ambiguous error , why?
var dbQuery = `INSERT INTO category_gallery (
category_id, gallery_id, crea...
Embowel asked 22/4, 2016 at 16:35
1 Next >
© 2022 - 2025 — McMap. All rights reserved.