Thanks so much for your help:
This works:
UPSERT INTO TESTTABLE1 (PK, CF.COL1 , CF.COL2 , CF.COL3 ) SELECT 'row2',
'xxx1', 'yyy1', 'zzz1' FROM TESTTABLE1 WHERE MEDIAID = '123';
--
Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/
I did following:
CREATE TABLE
CREATE TABLE IF NOT EXISTS TESTTABLE1 (PK VARCHAR NOT NULL PRIMARY KEY,
CF.COL1 VARCHAR, CF.COL2 VARCHAR, CF.COL3 VARCHAR, CF.MEDIAID VARCHAR);
UPSERT DATA
UPSERT INTO TESTTABLE1 (PK , CF.COL1 , CF.COL2 , CF.COL3 , CF.MEDIAID
)VALUES ('row1', 'data1','data2','data3'
Miles beat me to it, but yes that's what I was referring to.
On Mon, Jul 16, 2018 at 10:22 AM alchemist
wrote:
> Thanks so much William.
>
> I have a table with say TestTable with 5 columns, say rowPK, col1, col2,
> col3, mediaId etc.I need to update all the columns of this table for a
> set
UPSERT INTO TestTable (rowPK,col1,col2,col3)
SELECT rowPK, 'xxx', 'yyy', 'zzz'
FROM TestTable
WHERE mediaID = 123
Sent from my iPhone
> On Jul 16, 2018, at 10:22 AM, alchemist wrote:
>
> Thanks so much William.
>
> I have a table with say TestTable with 5 columns, say rowPK, col1, col2,
> col3
Thanks so much William.
I have a table with say TestTable with 5 columns, say rowPK, col1, col2,
col3, mediaId etc.I need to update all the columns of this table for a
set of mediaId (p.s here mediaId is not the rowkey). Suppose the initial
value of columns of TestTable is row1, 'aaa', 'bbb'
I believe you can try using UPSERT/SELECT on the same table (without a temp
table).
Maybe you can elaborate a little bit what you are trying to do, because
your example query doesnt totally make sense to me as it is upserting
values of col 3 and 4 into 1 and 2?
On Mon, Jul 16, 2018 at 6:19 AM alc
Thaks so much for your response: I am looking at UPSERT Grammar:
https://phoenix.apache.org/language/index.html#upsert_values
Looks like Phoenix does not support SET or WHERE with UPSERT.
We have UPSERT/SELECT but that is selecting data from another table to
insert into the current table.
Now Phoenix don not support where clause within upsert. I also think this
function is very important that use frequency is highly.
Maybe the dialect looks like this:
Upset into scheme.table_name set col=‘x’ where id=‘x’
This semantic to implement is easy in Phoenix, we just need once write rpc
Now Phoenix don not support where clause within upsert. I also think this
function is very important that use frequency is highly.
Maybe the dialect looks like this:
Upset into scheme.table_name set col=‘x’ where id=‘x’
This semantic to implement is easy in Phoenix, we just need once write rpc
Looks like UPSERT doesn't support a WHERE clause.
But people have used workaroung like following:
UPSERT INTO test.MyTable(col1, col2) SELECT col3, col4 FROM test.TempTable
WHERE col5 = ABC
Does that mean If I have a use case where I need to update all the columns
of the MyTable based on some ke
10 matches
Mail list logo