upsert

Can we UPSERT an EDGE in orientdb?

余生长醉 提交于 2019-12-01 09:29:10
Is it possible to get an example to upsert an edge in orientdb. IF it does not exist is there a way to check if the edge exist, if it does then just update the edge else create a new edge. I am using Orientdb 2.1.13 version. Thank you via SQL you can use the basic UPDATE command update written_by SET out = #9:2, in = #16:43, prop="gianni" UPSERT WHERE out = #9:2 and in = #16:43 http://orientdb.com/docs/last/SQL-Update.html 来源: https://stackoverflow.com/questions/38060343/can-we-upsert-an-edge-in-orientdb

Can we UPSERT an EDGE in orientdb?

烈酒焚心 提交于 2019-12-01 07:06:24
问题 Is it possible to get an example to upsert an edge in orientdb. IF it does not exist is there a way to check if the edge exist, if it does then just update the edge else create a new edge. I am using Orientdb 2.1.13 version. Thank you 回答1: via SQL you can use the basic UPDATE command update written_by SET out = #9:2, in = #16:43, prop="gianni" UPSERT WHERE out = #9:2 and in = #16:43 http://orientdb.com/docs/last/SQL-Update.html 来源: https://stackoverflow.com/questions/38060343/can-we-upsert-an

How to update all columns with INSERT … ON CONFLICT …?

谁说胖子不能爱 提交于 2019-12-01 04:06:05
I have a table with a single primary key. When I attempt to do an insert there may be a conflict caused by trying to insert a row with an existing key. I want to allow the insert to update all columns? Is there any easy syntax for this? I am trying to let it "upsert" all columns. I am using PostgreSQL 9.5.5. The UPDATE syntax requires to explicitly name target columns. Possible reasons to avoid that: You have many columns and just want to shorten the syntax. You do not know column names except for the unique column(s). "All columns" has to mean "all columns of the target table" (or at least

SQL standard UPSERT call

核能气质少年 提交于 2019-12-01 03:54:57
I'm looking for a standard SQL " UPSERT " statement. A one call for insert and update if exists. I'm looking for a working, efficient and cross platform call. I've seen MERGE , UPSERT , REPLACE , INSERT .. ON DUPLICATE UPDATE but no statement meets the needs. BTW I use MYSQL and HSQLDB for unitests. I understand that HSQLDB is limited and may not cover what I need, but I couldn't find a standard way even without it. A statement that only MYSQL and HSQLDB will also be enough for now. I've been looking around for a while and couldn't get an answer. My table: CREATE TABLE MY_TABLE ( MY_KEY

How to upsert in Postgres on conflict on one of 2 columns?

限于喜欢 提交于 2019-12-01 03:48:09
Is it possible to do upsert in Postgres 9.5 when conflict happens on one of 2 columns in a table.? Basically I have 2 columns and if either column throws unique constraint violation, then I would like to perform update operation. Yes, and this behaviour is default. Any unique constraint violation constitutes a conflict and then the UPDATE is performed if ON CONFLICT DO UPDATE is specified. The INSERT statement can have only a single ON CONFLICT clause, but the conflict_target of that clause can specify multiple column names each of which must have an index, such as a UNIQUE constraint. You are

If Record Exists, Update Else Insert

假装没事ソ 提交于 2019-12-01 03:15:20
I'm trying to move some data between two SQL Server 2008 tables. If the record exists in Table2 with the email from Table1 then update that record with the data from Table1, else insert a new record. In Table1 I have a number of columns; first name, surname, email and so on. I'm not quite sure how to structure the query to update Table2 if the email from Table1 exists or insert a new row if email from Table1 does not exist in Table2. I tried doing a few searches on Google but most solutions seem to work by creating some stored procedure. So I wondered if anyone might know how to build a

Updating the path 'x' would create a conflict at 'x'

被刻印的时光 ゝ 提交于 2019-12-01 02:35:29
This error happens when I tried to update upsert item: Updating the path 'x' would create a conflict at 'x' Field should appear either in $set , or in $setOnInsert . Not in both. RodrigoNOFX If you pass the same key in $set and in $unset when updating an item, you will get that error. For example: const body = { _id: '47b82d36f33ad21b90' name: 'John', lastName: 'Smith' } MyModel.findByIdAndUpdate(body._id, { $set: body, $unset: {name: 1}}) // Updating the path 'name' would create a conflict at 'name' I had the same problem while performing an update query using PyMongo. I was trying to do: >

Add or replace entity in Azure Table Storage

隐身守侯 提交于 2019-12-01 02:33:13
I'm working with Windows Azure Table Storage and have a simple requirement: add a new row, overwriting any existing row with that PartitionKey/RowKey. However, saving the changes always throws an exception, even if I pass in the ReplaceOnUpdate option: tableServiceContext.AddObject(TableName, entity); tableServiceContext.SaveChangesWithRetries(SaveChangesOptions.ReplaceOnUpdate); If the entity already exists it throws: System.Data.Services.Client.DataServiceRequestException: An error occurred while processing this request. ---> System.Data.Services.Client.DataServiceClientException: <?xml

Core Data “Upsert” from SQLite Database

你离开我真会死。 提交于 2019-12-01 01:11:02
I am currently writing an App that needs the ability to modify and persist various pieces of data. I've decided to use Core Data for this purpose. When the user opens the Application for the first time I need to import a large amount of data from a sqlite database, this data consists of the many-to-many relationships. I'd like to find out the best way to insert all of this data into my code data store. Right now I am using an NSOperation to do the import while that rest of the application remains active, so the user can do other things, but I'd like the import to happen as quickly as possible

How to upsert in Postgres on conflict on one of 2 columns?

可紊 提交于 2019-12-01 00:18:42
问题 Is it possible to do upsert in Postgres 9.5 when conflict happens on one of 2 columns in a table.? Basically I have 2 columns and if either column throws unique constraint violation, then I would like to perform update operation. 回答1: Yes, and this behaviour is default. Any unique constraint violation constitutes a conflict and then the UPDATE is performed if ON CONFLICT DO UPDATE is specified. The INSERT statement can have only a single ON CONFLICT clause, but the conflict_target of that