You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Ivan Daschinsky (Jira)" <ji...@apache.org> on 2021/08/02 10:02:00 UTC
[jira] [Commented] (IGNITE-15214) [python] When inserting datetime
via query_args, only the date is inserted.
[ https://issues.apache.org/jira/browse/IGNITE-15214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17391482#comment-17391482 ]
Ivan Daschinsky commented on IGNITE-15214:
------------------------------------------
Using the code
{code:python}
from pyignite import Client
from datetime import datetime
c = Client(username='', password='', use_ssl=False)
with c.connect('localhost', 10800):
current_time = datetime.now()
c.sql('drop table if exists test')
c.sql('create table test(key int primary key, date datetime)')
c.sql(f"insert into test VALUES (1, ?)", query_args=[current_time])
c.sql(f"insert into test VALUES (2, '{current_time}')")
with c.sql('SELECT key, date FROM test') as cursor:
for row in cursor:
print(row)
{code}
Cannot reproduce on pythons 3.6,3.7,3.8, 3.9 on pyignite 0.5.1 and on apache ignite 2.10 and 2.8.1
Could you please share more information regarding your envs?
[~prom1se]
> [python] When inserting datetime via query_args, only the date is inserted.
> ---------------------------------------------------------------------------
>
> Key: IGNITE-15214
> URL: https://issues.apache.org/jira/browse/IGNITE-15214
> Project: Ignite
> Issue Type: Bug
> Components: python, thin client
> Affects Versions: python-0.3.4, python-0.4.0, python-0.5.0, python-0.5.1
> Reporter: Fedor Malchikov
> Priority: Major
> Labels: python
> Attachments: image-2021-07-30-14-05-48-220.png
>
>
> reproducer:
> {code:python}
> from pyignite import Client
> from datetime import datetime
> c = Client(username='', password='', use_ssl=False)
> c.connect('localhost', 10800)
> current_time = datetime.now()
> c.sql('create table test(key int primary key, date datetime)')
> c.sql(f"insert into test VALUES (1, ?)", query_args=[current_time])
> c.sql(f"insert into test VALUES (2, '{current_time}')")
> for row in c.sql('SELECT key, date FROM test'):
> date = row
> print(date[0], date[1][0])
> c.close()
> {code}
> output:
> {code:python}
> 1 2021-07-30 00:00:00
> 2 2021-07-30 13:51:22.618000
> {code}
> in dbeaver:
> !image-2021-07-30-14-05-48-220.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)