You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Jueverhard <ju...@hotmail.fr> on 2020/04/20 15:25:47 UTC

How can I delete entries from a table using pyignite?

I have a Apache Ignite database running which I want to interact with using
Python thin client (pyignite). I've already performed create, read and
update operations, but I meet problems with the delete ones. For now, even
if the submission of delete request does not raise any error, the entries
that are supposed to be deleted are not.

I've tried deleting those same entries running the same delete query in
terminal via  and this does succesfully remove the targeted entries.

Here is how I unsuccesfully tried to delete data :  


Any help would be greatly appreciated, thanks !



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I delete entries from a table using pyignite?

Posted by akorensh <al...@gmail.com>.
Hi,
  Looks like you didn't finish your message: 
   from your post:  here is how I unsuccessfully tried to delete data :  ?

    
take a look at these examples:
https://github.com/apache/ignite/blob/master/modules/platforms/python/examples/sql.py

https://github.com/apache/ignite/blob/master/modules/platforms/python/examples/get_and_put.py


more info:
https://www.gridgain.com/docs/latest/getting-started/quick-start/python

Thanks, Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I delete entries from a table using pyignite?

Posted by Jueverhard <ju...@hotmail.fr>.
I don't know how could I verify if my query gets to run, but I came up with a
work around to simulate entries deletions ... Clearly not the best way to
deal with this, but at least it does the job :')

Thanks for helping !

Regards.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I delete entries from a table using pyignite?

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

1) Are you sure that your DELETE actually gets to run?
2) I think you need to stop SELECT iteration before running more queries,
including DELETE. Try closing cursor explicitly.

Regards,
-- 
Ilya Kasnacheev


вт, 5 мая 2020 г. в 11:12, Jueverhard <ju...@hotmail.fr>:

> Ok, I think the problem comes from raw text, it does not appear ...
> ```
> self.client = Client()
> self.client.connect('127.0.0.1', 10800)
> patientID = 5
> IS_DEFINED_QUERY = "SELECT * FROM Patients WHERE PatientID = ?"
> result = self.client.sql(
>     IS_DEFINED_QUERY,
>     query_args=[patientID]
> )
> try:
>     next(result)
>     DELETE_QUERY = "DELETE FROM Patients WHERE PatientID = ?"
>     self.client.sql(
>         DELETE_QUERY,
>         query_args=[patientID])
> except StopIteration:
>             raise KeyDoesNotExist()
> ```
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: How can I delete entries from a table using pyignite?

Posted by Jueverhard <ju...@hotmail.fr>.
Ok, I think the problem comes from raw text, it does not appear ...
```
self.client = Client()
self.client.connect('127.0.0.1', 10800)
patientID = 5
IS_DEFINED_QUERY = "SELECT * FROM Patients WHERE PatientID = ?"
result = self.client.sql(
    IS_DEFINED_QUERY,
    query_args=[patientID]
)
try:
    next(result)
    DELETE_QUERY = "DELETE FROM Patients WHERE PatientID = ?"
    self.client.sql(
        DELETE_QUERY,
        query_args=[patientID])
except StopIteration:
            raise KeyDoesNotExist()
```



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I delete entries from a table using pyignite?

Posted by Jueverhard <ju...@hotmail.fr>.
Uh, don't know what happened but here is the code that were missing :

I've got some answers elsewhere saying the code seems to be working, and
suggestions about database settings that could prevent deletions from Python
Thin Client, what do you think about it ?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I delete entries from a table using pyignite?

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

If there are any images, we never got to see these. Can you link them on
some external resource?

Thanks,
-- 
Ilya Kasnacheev


пн, 20 апр. 2020 г. в 18:25, Jueverhard <ju...@hotmail.fr>:

> I have a Apache Ignite database running which I want to interact with using
> Python thin client (pyignite). I've already performed create, read and
> update operations, but I meet problems with the delete ones. For now, even
> if the submission of delete request does not raise any error, the entries
> that are supposed to be deleted are not.
>
> I've tried deleting those same entries running the same delete query in
> terminal via  and this does succesfully remove the targeted entries.
>
> Here is how I unsuccesfully tried to delete data :
>
>
> Any help would be greatly appreciated, thanks !
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>