Questions tagged [upsert]

UPSERT is a combination of UPDATE and INSERT, typically used in relational databases.

Filter by
Sorted by
Tagged with
1 vote
1 answer
43 views

Re-using parameters passed to node-postgres upsert query

I'm using node-pg and I've decided to refactor some code that would first make a select query to see if a record exists and then make a second query to either insert or update a record. Suppose the ...
Mike K's user avatar
  • 5,999
1 vote
1 answer
44 views

How to use sqlalchemy's on_conflict_do_update.returning to return updated values?

I am trying to do an upsert statement and have the query return the updated values. On inserts, it works fine because there is no data but when there is an update, the query returns the old data that ...
user avatar
0 votes
0 answers
19 views

Supabase not updating columns using upsert

Whenever a user clicks on the same item again I want to update my "quantity" and "price" but not the "item". I tried using upsert, its successful but its not updating ...
Les Jetskii's user avatar
1 vote
2 answers
78 views

INSERT or UPDATE based on changing timestamp

I have a table where I record events. These events will come into the system once a minute, per user - on the order of 10's of thousands a minute. But I don't need to save all of them. If an event ...
bmatcuk's user avatar
  • 465
0 votes
1 answer
50 views

How to perform an upsert (insert + update) from a pyspark dataframe to an azure sql database table?

I am trying to do an upsert from a pyspark dataframe to a sql table. sparkdf is my pyspark dataframe. Test is my sql table in an azure sql database. I have the following so far: def ...
Herwini's user avatar
  • 387
0 votes
1 answer
30 views

How to update supabase record?

I want "item" to be unique so if a user click on the same item again, it'll update and add 1 to my "quantity" and add "price" and insert a new record if not unique. I ...
Les Jetskii's user avatar
0 votes
0 answers
35 views

Upserting data into Snowflake?

I have a use case where I need programmatically copy data from one or more JSON files into a Snowflake table. However, when I copy the files, I would also need to do an upsert of records. For example, ...
Pepria's user avatar
  • 394
2 votes
1 answer
68 views

How to Upsert records with jooq?

I am trying to upsert the rows which I retrieved from one table of a database to the identical table in another database. Both databases are postgresql. I just want to retrieve whole columns of the ...
kocakmo's user avatar
  • 23
0 votes
1 answer
75 views

How to use kotlin exposed upsert (Insert Or Update) functionality via DSL

How we can use kotlin exposed upsert functionality in DSL? there is some documentation on this but its very small and lacks a lot. Understaning how it works in code is hard too because it seems that ...
Milad Amery's user avatar
0 votes
0 answers
36 views

SSIS package fails when deployed to the SSIS Catalog with “The expression cannot be evaluated. Modify the expression to be valid”

I have written an SSIS package that is intended to handle our daily upserts. Extract .csv files are deposited from a central clinical application in the early hours of the morning on to a VM. The SSIS ...
AbsentGaijin's user avatar
0 votes
1 answer
42 views

postgres insert on conflict does not work with version 16 (at least)

insert into bt(g,accountnumber,InputDate,ValueDate,Amount,Currency,Code,Reason,Branch,Type,Reference,nl1,nl2,nl3,nl4,UniqueId,Balance,UniqueIdNew) (select 0 g, substring(l,1,13) ...
George Kourtis's user avatar
0 votes
1 answer
24 views

PG::UndefinedColumn (ERROR: column d.adsrc does not exist) when using upsert gem

I am currently using the Upsert gem for various operations in my project. Specifically, I rely on Upsert.batch in multiple places. Recently, I attempted to upgrade my PostgreSQL version to 15. However,...
scrscr87's user avatar
0 votes
1 answer
55 views

Jetpack Compose Room @Upsert implementation

New developer here, and I've been working on an app that I have functionally completed except for one thing, updating a character. A user can create their own character and delete it, but not update ...
IanOro's user avatar
  • 13
0 votes
0 answers
48 views

How Update data if already exists else insert using typeORM and Nestjs

I have table which contains the id, user_id, skill(will be unique for user), category (can be duplicated)etc. I want to store data like if skill already added by user, the skill should be overriden or ...
Digen's user avatar
  • 91
1 vote
1 answer
194 views

Update merge in pyspark takes very long

Why does the MERGE INTO statement take significantly longer to update records in the old DataFrame when the old DataFrame has over 200 columns compared to when the old DataFrame has only 5 columns? ...
JoostBerkers's user avatar
0 votes
1 answer
61 views

Make a specific bulk upsert using SQLAlchemy (MariaDB)

From a list of Item objects like so : class Item(Base): __tablename__ = 'items' item_id = Column(Integer, unique=True, primary_key=True,) price = Column(Integer(10)) updated_at = ...
exerte's user avatar
  • 1
1 vote
1 answer
51 views

In Spring Data MongoDB, is there a way to upsert a document when using @Update with a findAnd...ById method?

Note: example is using Spring Data MongoDB in Kotlin leveraging update methods as described at https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongodb.repositories.queries....
Matthew Adams's user avatar
0 votes
0 answers
33 views

[PostgreSQL]How to make an upsert function that takes as input a query, returned by another function

So I have a set of functions that perform calculation and return a table of result (multiple rows and columns). I want to pass this result into an upsert function I made that will store rows that will ...
Paul Gazagne's user avatar
0 votes
2 answers
242 views

how to perform merge into/upsert from azure databricks on Azure SQL tables

This is an ETL job. The transformations of data are written in Pyspark in Databricks, and the final data is loaded to Azure SQL tables. Say I have 100 records from yesterday in final table, and I get ...
Sivaani's user avatar
  • 25
0 votes
0 answers
224 views

Upsert and return all rows with supabase-js

I'm using the supabase js client. I have an array of records I'd like to insert into my table and return. The records must be unique, so if they already exists in the table they should be ignored, but ...
joudan's user avatar
  • 81
2 votes
1 answer
56 views

MongoDB: upserting array element

I'm trying to upsert a specific array element in a MongoDB document. this is an example of a document from my collection: { "_id":3, "name":alex, "array": [ { ...
DBnoob's user avatar
  • 21
-1 votes
2 answers
24 views

How do you do an upsert in CQL?

How do you do an UPSERT in CQL. I am finding conflicting information online. Is it possible to do an upsert with just an UPDATE?
778899's user avatar
  • 9
0 votes
1 answer
529 views

Upsert function in TypeORM

I am trying to implement upsert functionality to avoid redundant data into the database. Mentioned below is the schema that I have created. @Entity({ name: 'tokens' }) export class Token { @...
Yogesh Rao's user avatar
0 votes
0 answers
614 views

index.upsert(), Pinecone keeps throwing Type Error: object of type 'NoneType' has no len. Confirmed appropriate data structure

I have written a script that takes embeddings, ids, and metadata from a data table and upserts it to a pinecone index. I have confirmed multiple times that my data structure is correct. I am passing a ...
Antwoine Flowers's user avatar
2 votes
2 answers
87 views

How to INSERT or UPDATE depending on the result of SELECT in 1 statement

I'm trying to create an INSERT or UPDATE statement depending on the result of a SELECT statement in one go. Currently, I have this statement that doesn't work: UPDATE Inventory SET CQuantity = ...
chris_techno25's user avatar
0 votes
1 answer
190 views

How to pass an array of tuples as parameter for a bulk UPSERT?

With this schema: CREATE TABLE tag ( tag_id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, tag_slug text UNIQUE NOT NULL, tag_name text NOT NULL ); I'm currently using Javascript to generate ...
jrz's user avatar
  • 4,376
0 votes
0 answers
15 views

How to use the HarperDB upsert() function in python

I have been trying to use the HarperDB upsert() function (HarperDB object) on a python dev but I haven't found any API implementation of that function on the current packages. Have you ever used it? ...
Luiz's user avatar
  • 1
0 votes
0 answers
36 views

Upserting into PostgreSQL while DST change causes error

I am trying to upsert into PostgreSQL this set of data: INSERT INTO data_sensordata (sensor_id, timestamp, value, flag, tz_offset) VALUES ('20', timestamp with time zone '2015-03-29 00:15:00+02:00'...
xpanta's user avatar
  • 8,196
0 votes
1 answer
121 views

Need workaround when using MongoDB SQL Connector in Flink

In our project we have requirement which uses Apache Flink which will write data from flink to Mongo db using SQL connector https://nightlies.apache.org/flink/flink-docs-master/docs/connectors/table/...
Arun's user avatar
  • 15
0 votes
1 answer
84 views

Efficient way to perform UPSERT in DynamoDB for multiple items

In DynamoDB , we will have 20000 records . Each request has 4 itemId for which the records has to be updated if exist / inserted if record for that itemId is not available . updateItem would be the ...
ani's user avatar
  • 456
1 vote
0 answers
89 views

Catch multiple constraints with ON CONFLICT upsert pgsql

I use an INSERT ON CONFLICT UPDATE upsert to perform regular syncs from low to high environments. I defer all constraints before the upsert, however I recently had to add a partial unique index which ...
Chad S's user avatar
  • 53
0 votes
0 answers
6 views

CRM Upsert except if modified by non integration user

Is there a way to not update a record if it's been modified by a regular user? Tried Adding a join to the user table with a unique Id is null because I am trying to update all records that are svc ...
user2363562's user avatar
1 vote
1 answer
722 views

upsert_item into cosmosdb via python

I have a this code: import logging import json import os from azure.cosmos import CosmosClient import azure.functions as func url = os.environ["ACCOUNT_URI"] key = os.environ["...
aca1803's user avatar
  • 21
0 votes
1 answer
44 views

Complex DynamoDB update statement

I have a dynamodb table "metas" which has a field of id, time, ttl. I want to upsert an item with id X. The updated field is time and only update if the new value is bigger than the old ...
Vince's user avatar
  • 1
0 votes
1 answer
152 views

How to Upsert item with unique index in Android Room?

I have JSON data in an API host like this "product": { "barcode": "2489752310342", "productName": "Trench coat", "priceList&...
oguzata's user avatar
  • 33
0 votes
1 answer
346 views

Laravel Eloquent upsert method does not recognise UUID primary key and generates insert statement

I'm working on the project with the following code: Schema Schema::create('form_pages', function (Blueprint $table) { $table->uuid('id')->primary(); $table->foreignUuid('form_id') ...
Sebastian Sulinski's user avatar
0 votes
0 answers
32 views

Postgres complexe upsert

I have the following postgres upsert query : CREATE TABLE IF NOT EXISTS dm_insights_best_performing_format_view_two ( id SERIAL PRIMARY KEY, platform VARCHAR(255) NOT NULL, ...
Tom687's user avatar
  • 192
0 votes
1 answer
40 views

Prepared upsert giving unexpected "ambigous column" error

I have the following problem: I'm trying to created an "alias" for an UPSERT statement by creating a prepared statement. The statement operates on a table called "Sale" which has ...
randomdood1923's user avatar
-1 votes
1 answer
318 views

How to upsert Hive tables in PySpark?

I need to do the following upsert in Hive table if the column with patientnumber exists and if it is same as the casenumber column then update the record as it is else insert new row. if ...
Rajakumar S's user avatar
0 votes
0 answers
147 views

UPSERT with Pandas DF in SQLAlchemy and Azure SQL Server taking too long for large table. How can I optimize it?

I am getting data from an API using Python and then transforming this data into a Pandas Dataframe. This dataframe has a column Date and more 50 columns. I have retrieved the data from the whole past ...
carolina131's user avatar
1 vote
1 answer
604 views

Gremlin MergeV To Update an Existing Element's property and Single Cardinality

I am using Amazon Neptune with Gremlin-go for our Graph Database needs. I am working on code to insert/update (upsert) an element with g.mergeV(). However, when a match is found, and a property gets ...
newbie123's user avatar
0 votes
1 answer
91 views

Cloud SQL to BigQuery Upsert Query using external connection

Referring to this link BigQuery dynamic UPSERT with EXECUTE IMMEDIATE I just wanted to follow same procedure to periodically Insert or Updated any changed data into BigQuery but from external Cloud ...
Ahmad Coachendo's user avatar
0 votes
2 answers
83 views

Postgresql UPSERT while encrypting column by python encryption

I am using BULK UPSERT to insert record into new table while data of column is being encrypting by python lib CryptoDome. here is what I done def bulk_upsert_query(data, table_name=None): ...
Sohel Reza's user avatar
0 votes
0 answers
21 views

Using UPSERT to update conflicting record and inserting a new one afterwards? [duplicate]

I'm trying to figure out if there's a way to use an UPSERT ON CONSTRAINT statement in a way that, on conflict, it would update the conflicting record to solve the conflict and afterwards, insert a new ...
zzzzzz's user avatar
  • 1
0 votes
0 answers
8 views

which GPDB version support upsert or merge grammar?

In my work , i need to use upsert or merge . insert into xxxx on conflict update xxx. merge into xxx. insert into xxxx on conflict update xxx. merge into xxx.
sunner's user avatar
  • 1
0 votes
2 answers
186 views

Column reference in "On Conflict" is ambiguous

I created the following table: CREATE TABLE IF NOT EXISTS public.publications ( publication_id bigint NOT NULL DEFAULT nextval('eap_publications_publication_id_seq'::regclass), title character ...
Rune's user avatar
  • 67
0 votes
1 answer
38 views

INSERT or SUM multiple rows at once

I want to increase multiple values at once, with the following logic: if the value does not exist, create a new row with the value, otherwise sum with the existing value on the database. To achieve ...
Stefano's user avatar
  • 58
0 votes
1 answer
637 views

Get inserted and updated rows after using upsert Laravel

When I use upsert function, I want to get inserted and updated rows . What should I do ? Any idea is very important to me. Thank a lot ! I am using MySQL. Here is my example code : Flight::upsert([ ...
Paul J.K's user avatar
  • 657
0 votes
0 answers
33 views

Chose the best sort key strategy for upserting in Redshfit

I need to daily perform merges on an event table which contains a primary key column (pk), a timestamp column (timestamp) and any other ones. The upsert is performed the classical way: copy file into ...
felicienb's user avatar
0 votes
1 answer
76 views

wrror with mongodb query on node.js named MongoServerError: cannot infer query fields to set, path 'channelId' is matched twice

query is here ChannelSubscribers.updateOne( { $and: [ { "channelId": userChannelId }, { "subscriberId": dict.subscriberId }, ], }, ...
RAGHAV MANGAL's user avatar

1
2 3 4 5
25