Keep a field from updating in Data Factory - azure

I'm writing a Data Flow in which I make an upsert to a Cosmos DB NoSQL database. My goal is to use a field called batch to keep track of the date of insertion of a particular document, that is, I want this field to not change over an update. I see that the AlterRow action doesn't let me choose which fields to partially upsert or not. Is there a way to accomplish this?

Agree with HimanshuSinha-msft if you select Upsert if it will update all the columns Instead select Update if with condition
equals(source1#id,source2#id)
And in sink setting select Update method as Allow update and pass partition key.
In mapping only select columns you want to update
Mapping >> Uncheck Auto mapping >> select columns you want to update

I think if you use UPSERT , then it will update all the fields , but UPDATE should allow you to do so .

Related

How can I delete documents from couchdb using filters?

I'm searching a curl command to delete documents filtered with few conditions or other ways to delete specific documents. Is there any way to achieve that?
You can't do that in one query like you would do in SQL.
You have to query the documents with a filter (let's say a Mango Selector). Then, you need to update those documents with the field "_deleted": true to delete it.
Photon admin panel since v1.9.30 allows to select results of viewindex function and treats a selection as a list of documents. Having appropriate index you can select its parent docs and then delete them.

Mongoose How to update if exists, based on custom fields. Otherwise insert

I'm building a mongoDB database that holds sales data from multiple different systems. Each system is integrated via an node/mongoose/Express API that I'm creating for the database. Typically, you'd check the id to determine if a record already exists, and insert it if it doesn't. But since the ID from these different sources could technically overlap, I need a system to make sure that a source can only update records that originally came from that source. So I've added a column called "external_ID" where the record id from the source is saved, and another column called "integration ID", which will be unique to the specific system that sends data. But for that idea to work, I'd need to update only if those two columns matches, and otherwise insert a new record. Is that possible with MongoDB, or am I approaching this wrong?
Thank you so much.
Use upsert on update(). It will creates a new document when no document matches the query criteria.
db.collection.update(<query>, <update>, { upsert: true })
You can find more detail at Upsert Behavior documentation

Batch update by "update" query of cqlsh in Cassandra

I want to do batch update for all rows, using update query. I know there is BATCH query. But, I have to list all rows..
So, I want to do something like :
UPDATE test set value=0x31 where id in ( SELECT id from test );
Is there any way doing something like the above?
The idea is the same as SQL. select all rows & and insert them into "in" part.
The reason why I want to do this is that I added a new column to the existing column family, which created null data in the new created column.
And, this cause an error for retrieving data from Cassandra.
I think the examples shown here might help: http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/update_r.html?scroll=reference_ds_g4h_qzq_xj__description_unique_31
Update a column in several rows at once:
UPDATE users
SET state = 'TX'
WHERE user_uuid
IN (88b8fd18-b1ed-4e96-bf79-4280797cba80,
06a8913c-c0d6-477c-937d-6c1b69a95d43,
bc108776-7cb5-477f-917d-869c12dfffa8);

Select clause editing in RedQueryBuilder

I'm looking into using RedQueryBuilder for a web-based query builder. I want my users to be able to specify what data they want to retrieve in the select clause, but the demo site
only shows selecting a single table, rendering all the columns of that table in the result. Does RedQueryBuilder support building out a more robust select clause, like specifying which specific columns to retrieve including those joined from other tables?
I'm afraid not. The project just concentrates on defining a query to return rows not what to show in those rows.
The onTableChange callback would feed you the list of tables in the expression so could go from that to a list of available columns...
Would you want/need to alter the SQL query generated or just the display of the results?
Personally I'd be interested in changing the demo into a more useful query too although the scope of that could be huge.

Updating a table Access and Excel VBA

I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed in an excel sheet that is connected with MS Access database. ID is the only unique field. Sometimes, my user submits a transaction that has let's say 5 records. Then, they want to modify the submitted data in case if they entered incorrect amount and they want to correct it. I want to write a code in VBA that will do the update. my current query is:
Update table Transaction(ProductName,Amount) set ProductName=#Product,Amount=#Amount)
where Date=#date;
This query does not work fine because obviously it replaces all the records data with the data of the last resubmitted record because my condition is weak. My difficulty is that I can't find a good condition in the where clause that will do the update a record by record accordingly.
Please help,
You will need to use the unique id of the record, in your case the ID field to guarantee you are updating the correct record.
Something like the following:
Update table Transaction(ProductName,Amount) set ProductName=#Product,Amount=#Amount) where ID = "id of record you want to update"
Enjoy!

Resources