- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to update in phoenix based on specific columns?
- Labels:
-
Apache Phoenix
Created ‎10-02-2017 04:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to figure out a way to do the equivalent of below command in phoenix:
update ics_tag_list set targetColumn = concat( 'prefix', sourceColumn) where rig =somerig;
I know that Phoenix does not support update command to update rows. But how do I update rows without entering values of all the columns in the query as an upsert command? Even with the upsert select command, we can only select values from other tables but I am not able to think of a way to generate the equivalent of above query in Phoenix since my source and target columns will change upon selection in the UI.
Created ‎10-02-2017 05:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can specify the columns that you want to update as long as you have the primary-key constraint columns available.
> create table t(pk varchar not null primary key, col1 integer, col2 integer, col3 integer); > upsert into t(pk, col2) values('a', 2);
When you provide fewer columns than the schema defines, the other columns will receive no new value. This is an equivalent operation to an "UPDATE" in a traditional RDBMS.
Created ‎10-02-2017 05:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can specify the columns that you want to update as long as you have the primary-key constraint columns available.
> create table t(pk varchar not null primary key, col1 integer, col2 integer, col3 integer); > upsert into t(pk, col2) values('a', 2);
When you provide fewer columns than the schema defines, the other columns will receive no new value. This is an equivalent operation to an "UPDATE" in a traditional RDBMS.
