You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by A <ht...@yahoo.com.INVALID> on 2019/09/12 04:04:56 UTC

Update/where statement Adds Row

I have an update statement that has a where clause with the primary key (email,companyid).
When executed it always creates a new row. It’s like it’s not finding the existing row with the primary key.
I’m using Cassandra-driver.
What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be using the where clause to identify the existing row?
Thanks,Angel


Sent from Yahoo Mail for iPhone

Re: Update/where statement Adds Row

Posted by A <ht...@yahoo.com.INVALID>.
Thank you.


Sent from Yahoo Mail for iPhone


On Thursday, September 12, 2019, 1:09 AM, Hossein Ghiyasi Mehr <gh...@gmail.com> wrote:

Update in Cassandra is upsert (update or insert). So when you update a row which isn't exist, it will create it."IF EXIST" can be used in some queries.
On Thu, Sep 12, 2019 at 8:35 AM A <ht...@yahoo.com.invalid> wrote:

I have an update statement that has a where clause with the primary key (email,companyid).
When executed it always creates a new row. It’s like it’s not finding the existing row with the primary key.
I’m using Cassandra-driver.
What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be using the where clause to identify the existing row?
Thanks,Angel


Sent from Yahoo Mail for iPhone





Re: Update/where statement Adds Row

Posted by Hossein Ghiyasi Mehr <gh...@gmail.com>.
Update in Cassandra is upsert (update or insert). So when you update a row
which isn't exist, it will create it.
"IF EXIST" can be used in some queries.

On Thu, Sep 12, 2019 at 8:35 AM A <ht...@yahoo.com.invalid> wrote:

> I have an update statement that has a where clause with the primary key
> (email,companyid).
>
> When executed it always creates a new row. It’s like it’s not finding the
> existing row with the primary key.
>
> I’m using Cassandra-driver.
>
> What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be
> using the where clause to identify the existing row?
>
> Thanks,
> Angel
>
>
>
> Sent from Yahoo Mail for iPhone
> <https://overview.mail.yahoo.com/?.src=iOS>
>

Re: Update/where statement Adds Row

Posted by A <ht...@yahoo.com.INVALID>.
Good idea. Tried that and it doesn’t add anything to the existing table, which exists....


Sent from Yahoo Mail for iPhone


On Wednesday, September 11, 2019, 9:08 PM, JOHN, BIBIN <bj...@att.com> wrote:

#yiv9726893009 #yiv9726893009 -- _filtered #yiv9726893009 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv9726893009 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv9726893009 #yiv9726893009 p.yiv9726893009MsoNormal, #yiv9726893009 li.yiv9726893009MsoNormal, #yiv9726893009 div.yiv9726893009MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:sans-serif;}#yiv9726893009 a:link, #yiv9726893009 span.yiv9726893009MsoHyperlink {color:blue;text-decoration:underline;}#yiv9726893009 a:visited, #yiv9726893009 span.yiv9726893009MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv9726893009 pre {margin:0in;margin-bottom:.0001pt;font-size:10.0pt;}#yiv9726893009 p.yiv9726893009msonormal0, #yiv9726893009 li.yiv9726893009msonormal0, #yiv9726893009 div.yiv9726893009msonormal0 {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv9726893009 span.yiv9726893009EmailStyle18 {font-family:sans-serif;color:#1F497D;}#yiv9726893009 span.yiv9726893009HTMLPreformattedChar {}#yiv9726893009 span.yiv9726893009hljs-operator {}#yiv9726893009 span.yiv9726893009hljs-keyword {}#yiv9726893009 span.yiv9726893009hljs-string {}#yiv9726893009 span.yiv9726893009hljs-builtin {}#yiv9726893009 .yiv9726893009MsoChpDefault {font-size:10.0pt;} _filtered #yiv9726893009 {margin:1.0in 1.0in 1.0in 1.0in;}#yiv9726893009 div.yiv9726893009WordSection1 {}#yiv9726893009 
Use if exists clause.
 
  
 
UPDATE table
 
SET column ='something'
 
WHERE key = ‘value’ IF EXISTS;
 
  
 
  
 
  
 
  
 
  
 
From: A <ht...@yahoo.com.INVALID> 
Sent: Wednesday, September 11, 2019 11:05 PM
To: User cassandra.apache.org <us...@cassandra.apache.org>
Subject: Update/where statement Adds Row
 
  
 
I have an update statement that has a where clause with the primary key (email,companyid).
 
  
 
When executed it always creates a new row. It’s like it’s not finding the existing row with the primary key.
 
  
 
I’m using Cassandra-driver.
 
  
 
What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be using the where clause to identify the existing row?
 
  
 
Thanks,
 
Angel
 



Sent from Yahoo Mail for iPhone
 



Re: Update/where statement Adds Row

Posted by Jon Haddad <jo...@jonhaddad.com>.
Probably not a great idea unless you're using it sparingly. Using LWTs
without knowing all the caveats is likely to lead to terrible cluster
performance.




On Wed, Sep 11, 2019, 10:59 PM A <ht...@yahoo.com.invalid> wrote:

> Is it ok if I do this?
>
> ... where email = em AND company_id = id IF EXISTS
>
>
>
>
>
> Sent from Yahoo Mail for iPhone
> <https://overview.mail.yahoo.com/?.src=iOS>
>
> On Wednesday, September 11, 2019, 9:08 PM, JOHN, BIBIN <bj...@att.com>
> wrote:
>
> Use if exists clause.
>
>
>
> *UPDATE* table
>
> *SET* column ='something'
>
> WHERE key = ‘value’ IF EXISTS;
>
>
>
>
>
>
>
>
>
>
>
> *From:* A <ht...@yahoo.com.INVALID>
> *Sent:* Wednesday, September 11, 2019 11:05 PM
> *To:* User cassandra.apache.org <us...@cassandra.apache.org>
> *Subject:* Update/where statement Adds Row
>
>
>
> I have an update statement that has a where clause with the primary key
> (email,companyid).
>
>
>
> When executed it always creates a new row. It’s like it’s not finding the
> existing row with the primary key.
>
>
>
> I’m using Cassandra-driver.
>
>
>
> What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be
> using the where clause to identify the existing row?
>
>
>
> Thanks,
>
> Angel
>
>
>
>
> Sent from Yahoo Mail for iPhone
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__overview.mail.yahoo.com_-3F.src-3DiOS&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=eFshZuDXOwvmW_UjVcAH8Q&m=FgFsGQLanA1ngbbLdQ2MKd0wBFNiXHtKVDZIEi2z_Qk&s=ZTUXV9cgMyKnreKaza7UCRQTtJjk_iygFCPGYX5X1es&e=>
>
>

Re: Update/where statement Adds Row

Posted by A <ht...@yahoo.com.INVALID>.
Is it ok if I do this? 
... where email = em AND company_id = id IF EXISTS




Sent from Yahoo Mail for iPhone


On Wednesday, September 11, 2019, 9:08 PM, JOHN, BIBIN <bj...@att.com> wrote:

#yiv9726893009 #yiv9726893009 -- _filtered #yiv9726893009 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv9726893009 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv9726893009 #yiv9726893009 p.yiv9726893009MsoNormal, #yiv9726893009 li.yiv9726893009MsoNormal, #yiv9726893009 div.yiv9726893009MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:sans-serif;}#yiv9726893009 a:link, #yiv9726893009 span.yiv9726893009MsoHyperlink {color:blue;text-decoration:underline;}#yiv9726893009 a:visited, #yiv9726893009 span.yiv9726893009MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv9726893009 pre {margin:0in;margin-bottom:.0001pt;font-size:10.0pt;}#yiv9726893009 p.yiv9726893009msonormal0, #yiv9726893009 li.yiv9726893009msonormal0, #yiv9726893009 div.yiv9726893009msonormal0 {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv9726893009 span.yiv9726893009EmailStyle18 {font-family:sans-serif;color:#1F497D;}#yiv9726893009 span.yiv9726893009HTMLPreformattedChar {}#yiv9726893009 span.yiv9726893009hljs-operator {}#yiv9726893009 span.yiv9726893009hljs-keyword {}#yiv9726893009 span.yiv9726893009hljs-string {}#yiv9726893009 span.yiv9726893009hljs-builtin {}#yiv9726893009 .yiv9726893009MsoChpDefault {font-size:10.0pt;} _filtered #yiv9726893009 {margin:1.0in 1.0in 1.0in 1.0in;}#yiv9726893009 div.yiv9726893009WordSection1 {}#yiv9726893009 
Use if exists clause.
 
  
 
UPDATE table
 
SET column ='something'
 
WHERE key = ‘value’ IF EXISTS;
 
  
 
  
 
  
 
  
 
  
 
From: A <ht...@yahoo.com.INVALID> 
Sent: Wednesday, September 11, 2019 11:05 PM
To: User cassandra.apache.org <us...@cassandra.apache.org>
Subject: Update/where statement Adds Row
 
  
 
I have an update statement that has a where clause with the primary key (email,companyid).
 
  
 
When executed it always creates a new row. It’s like it’s not finding the existing row with the primary key.
 
  
 
I’m using Cassandra-driver.
 
  
 
What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be using the where clause to identify the existing row?
 
  
 
Thanks,
 
Angel
 



Sent from Yahoo Mail for iPhone
 



RE: Update/where statement Adds Row

Posted by "JOHN, BIBIN" <bj...@att.com>.
Use if exists clause.

UPDATE table
SET column ='something'
WHERE key = ‘value’ IF EXISTS;





From: A <ht...@yahoo.com.INVALID>
Sent: Wednesday, September 11, 2019 11:05 PM
To: User cassandra.apache.org <us...@cassandra.apache.org>
Subject: Update/where statement Adds Row

I have an update statement that has a where clause with the primary key (email,companyid).

When executed it always creates a new row. It’s like it’s not finding the existing row with the primary key.

I’m using Cassandra-driver.

What am I doing wrong? I don’t want a new row. Why doesn’t it seem to be using the where clause to identify the existing row?

Thanks,
Angel



Sent from Yahoo Mail for iPhone<https://urldefense.proofpoint.com/v2/url?u=https-3A__overview.mail.yahoo.com_-3F.src-3DiOS&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=eFshZuDXOwvmW_UjVcAH8Q&m=FgFsGQLanA1ngbbLdQ2MKd0wBFNiXHtKVDZIEi2z_Qk&s=ZTUXV9cgMyKnreKaza7UCRQTtJjk_iygFCPGYX5X1es&e=>