You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Stéphane Thibaud <sn...@gmail.com> on 2019/05/04 07:39:38 UTC

Timestamp with Python thin client

Hello Apache users,

I am running into the following issue: when I try to store a timestamp with
nanosecond precision with the Python Thin client, I get the stack trace
below. I have specified the timestamp as a tuple of (datetime, nanoseconds)
as that is the format in which I also get timestamps back from the apache
ignite client. Strangely, I can set just a datetime, but then the
nanoseconds become zero. Am I doing it in the wrong way? Any suggestions?



    db.sql(query, query_args=[converted_row[c] for c in table.column_names])
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
line 401, in sql
    max_rows, timeout,
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
line 370, in sql_fields
    'include_field_names': include_field_names,
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
line 260, in from_python
    buffer += c_type.from_python(values[name])
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
line 471, in from_python
    buffer += infer_from_python(x)
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
line 399, in infer_from_python
    if is_hinted(value):
  File
"/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
line 51, in is_hinted
    and issubclass(value[1], IgniteDataType)
  File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class

Kind regards,

Stéphane Thibaud

Re: Timestamp with Python thin client

Posted by Stéphane Thibaud <sn...@gmail.com>.
Thank you very much. It is completely clear to me now.


Kind regards,

Stéphane Thibaud

2019年5月17日(金) 20:56 Igor Sapego <is...@apache.org>:

> These are nanosecond fraction of the last microsecond (It can be only from
> 0 to 999).
>
> Ignite's Timestamp have a nanoseconds precision, so it can not be
> represented
> by the datetime type only.
>
> You can find some details here: [1]
>
> [1] -
> https://apache-ignite-binary-protocol-client.readthedocs.io/en/latest/source/pyignite.datatypes.standard.html#pyignite.datatypes.standard.TimestampObject
>
>
> Best Regards,
> Igor
>
>
>
> On Thu, May 16, 2019 at 9:02 AM Stéphane Thibaud <sn...@gmail.com>
> wrote:
>
>> I see. Thank you. I am still a bit unsure about what the second value in
>> the tuple represents. Are these indeed the nanoseconds? Apparently a Python
>> datetime can have differing precisions (perhaps depending on platform)...
>>
>>
>> Kind regards,
>>
>> Stéphane Thibaud
>>
>>
>> 2019年5月16日(木) 0:10 Igor Sapego <is...@apache.org>:
>>
>>> I believe, it's OK to pass tuple for timestamp in python, but you also
>>> should
>>> add a tip for the client to inform it you are going to store timestamp
>>> value.
>>>
>>> Take a look at tests for example: [1]
>>>
>>> 1 -
>>> https://github.com/apache/ignite/blob/master/modules/platforms/python/tests/test_datatypes.py#L80
>>>
>>> Best Regards,
>>> Igor
>>>
>>>
>>> On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <sn...@gmail.com>
>>> wrote:
>>>
>>>> Thank you. I will try to create a code line to reproduce it, but I
>>>> remember the following: when you do a 'select' query on a timestamp column
>>>> with the Python thin client, you get a tuple. Because of that, I assumed
>>>> that a tuple also had to be written in an update query.
>>>>
>>>>
>>>> Kind regards,
>>>>
>>>> Stéphane Thibaud
>>>>
>>>> 2019年5月15日(水) 17:59 Igor Sapego <is...@apache.org>:
>>>>
>>>>> Stéphane,
>>>>>
>>>>> Can you sharer a code line, how do you try to store timestamp value?
>>>>>
>>>>> Best Regards,
>>>>> Igor
>>>>>
>>>>>
>>>>> On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <
>>>>> dmekhanikov@gmail.com> wrote:
>>>>>
>>>>>> Stéphane,
>>>>>>
>>>>>> Could you provide the code, that results in this exception?
>>>>>> Do you try to insert the tuple as a single field via SQL? There is no
>>>>>> such primitive as a tuple in SQL, so you should probably split timestamp
>>>>>> into datetime and nanoseconds columns and store them separately as two
>>>>>> different columns.
>>>>>>
>>>>>> Denis
>>>>>>
>>>>>> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>>>>>>
>>>>>>> Hello Apache users,
>>>>>>>
>>>>>>> I am running into the following issue: when I try to store a
>>>>>>> timestamp with nanosecond precision with the Python Thin client, I get the
>>>>>>> stack trace below. I have specified the timestamp as a tuple of (datetime,
>>>>>>> nanoseconds) as that is the format in which I also get timestamps back from
>>>>>>> the apache ignite client. Strangely, I can set just a datetime, but then
>>>>>>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     db.sql(query, query_args=[converted_row[c] for c in
>>>>>>> table.column_names])
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>>>>>>> line 401, in sql
>>>>>>>     max_rows, timeout,
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>>>>>>> line 370, in sql_fields
>>>>>>>     'include_field_names': include_field_names,
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>>>>>>> line 260, in from_python
>>>>>>>     buffer += c_type.from_python(values[name])
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>>>> line 471, in from_python
>>>>>>>     buffer += infer_from_python(x)
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>>>> line 399, in infer_from_python
>>>>>>>     if is_hinted(value):
>>>>>>>   File
>>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>>>>>>> line 51, in is_hinted
>>>>>>>     and issubclass(value[1], IgniteDataType)
>>>>>>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>>>>>>     return _abc_subclasscheck(cls, subclass)
>>>>>>> TypeError: issubclass() arg 1 must be a class
>>>>>>>
>>>>>>> Kind regards,
>>>>>>>
>>>>>>> Stéphane Thibaud
>>>>>>>
>>>>>>>
>>>>>>>

Re: Timestamp with Python thin client

Posted by Igor Sapego <is...@apache.org>.
These are nanosecond fraction of the last microsecond (It can be only from
0 to 999).

Ignite's Timestamp have a nanoseconds precision, so it can not be
represented
by the datetime type only.

You can find some details here: [1]

[1] -
https://apache-ignite-binary-protocol-client.readthedocs.io/en/latest/source/pyignite.datatypes.standard.html#pyignite.datatypes.standard.TimestampObject


Best Regards,
Igor



On Thu, May 16, 2019 at 9:02 AM Stéphane Thibaud <sn...@gmail.com>
wrote:

> I see. Thank you. I am still a bit unsure about what the second value in
> the tuple represents. Are these indeed the nanoseconds? Apparently a Python
> datetime can have differing precisions (perhaps depending on platform)...
>
>
> Kind regards,
>
> Stéphane Thibaud
>
>
> 2019年5月16日(木) 0:10 Igor Sapego <is...@apache.org>:
>
>> I believe, it's OK to pass tuple for timestamp in python, but you also
>> should
>> add a tip for the client to inform it you are going to store timestamp
>> value.
>>
>> Take a look at tests for example: [1]
>>
>> 1 -
>> https://github.com/apache/ignite/blob/master/modules/platforms/python/tests/test_datatypes.py#L80
>>
>> Best Regards,
>> Igor
>>
>>
>> On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <sn...@gmail.com>
>> wrote:
>>
>>> Thank you. I will try to create a code line to reproduce it, but I
>>> remember the following: when you do a 'select' query on a timestamp column
>>> with the Python thin client, you get a tuple. Because of that, I assumed
>>> that a tuple also had to be written in an update query.
>>>
>>>
>>> Kind regards,
>>>
>>> Stéphane Thibaud
>>>
>>> 2019年5月15日(水) 17:59 Igor Sapego <is...@apache.org>:
>>>
>>>> Stéphane,
>>>>
>>>> Can you sharer a code line, how do you try to store timestamp value?
>>>>
>>>> Best Regards,
>>>> Igor
>>>>
>>>>
>>>> On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <dm...@gmail.com>
>>>> wrote:
>>>>
>>>>> Stéphane,
>>>>>
>>>>> Could you provide the code, that results in this exception?
>>>>> Do you try to insert the tuple as a single field via SQL? There is no
>>>>> such primitive as a tuple in SQL, so you should probably split timestamp
>>>>> into datetime and nanoseconds columns and store them separately as two
>>>>> different columns.
>>>>>
>>>>> Denis
>>>>>
>>>>> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>>>>>
>>>>>> Hello Apache users,
>>>>>>
>>>>>> I am running into the following issue: when I try to store a
>>>>>> timestamp with nanosecond precision with the Python Thin client, I get the
>>>>>> stack trace below. I have specified the timestamp as a tuple of (datetime,
>>>>>> nanoseconds) as that is the format in which I also get timestamps back from
>>>>>> the apache ignite client. Strangely, I can set just a datetime, but then
>>>>>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>>>>>> suggestions?
>>>>>>
>>>>>>
>>>>>>
>>>>>>     db.sql(query, query_args=[converted_row[c] for c in
>>>>>> table.column_names])
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>>>>>> line 401, in sql
>>>>>>     max_rows, timeout,
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>>>>>> line 370, in sql_fields
>>>>>>     'include_field_names': include_field_names,
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>>>>>> line 260, in from_python
>>>>>>     buffer += c_type.from_python(values[name])
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>>> line 471, in from_python
>>>>>>     buffer += infer_from_python(x)
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>>> line 399, in infer_from_python
>>>>>>     if is_hinted(value):
>>>>>>   File
>>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>>>>>> line 51, in is_hinted
>>>>>>     and issubclass(value[1], IgniteDataType)
>>>>>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>>>>>     return _abc_subclasscheck(cls, subclass)
>>>>>> TypeError: issubclass() arg 1 must be a class
>>>>>>
>>>>>> Kind regards,
>>>>>>
>>>>>> Stéphane Thibaud
>>>>>>
>>>>>>
>>>>>>

Re: Timestamp with Python thin client

Posted by Stéphane Thibaud <sn...@gmail.com>.
I see. Thank you. I am still a bit unsure about what the second value in
the tuple represents. Are these indeed the nanoseconds? Apparently a Python
datetime can have differing precisions (perhaps depending on platform)...


Kind regards,

Stéphane Thibaud


2019年5月16日(木) 0:10 Igor Sapego <is...@apache.org>:

> I believe, it's OK to pass tuple for timestamp in python, but you also
> should
> add a tip for the client to inform it you are going to store timestamp
> value.
>
> Take a look at tests for example: [1]
>
> 1 -
> https://github.com/apache/ignite/blob/master/modules/platforms/python/tests/test_datatypes.py#L80
>
> Best Regards,
> Igor
>
>
> On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <sn...@gmail.com>
> wrote:
>
>> Thank you. I will try to create a code line to reproduce it, but I
>> remember the following: when you do a 'select' query on a timestamp column
>> with the Python thin client, you get a tuple. Because of that, I assumed
>> that a tuple also had to be written in an update query.
>>
>>
>> Kind regards,
>>
>> Stéphane Thibaud
>>
>> 2019年5月15日(水) 17:59 Igor Sapego <is...@apache.org>:
>>
>>> Stéphane,
>>>
>>> Can you sharer a code line, how do you try to store timestamp value?
>>>
>>> Best Regards,
>>> Igor
>>>
>>>
>>> On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <dm...@gmail.com>
>>> wrote:
>>>
>>>> Stéphane,
>>>>
>>>> Could you provide the code, that results in this exception?
>>>> Do you try to insert the tuple as a single field via SQL? There is no
>>>> such primitive as a tuple in SQL, so you should probably split timestamp
>>>> into datetime and nanoseconds columns and store them separately as two
>>>> different columns.
>>>>
>>>> Denis
>>>>
>>>> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>>>>
>>>>> Hello Apache users,
>>>>>
>>>>> I am running into the following issue: when I try to store a timestamp
>>>>> with nanosecond precision with the Python Thin client, I get the stack
>>>>> trace below. I have specified the timestamp as a tuple of (datetime,
>>>>> nanoseconds) as that is the format in which I also get timestamps back from
>>>>> the apache ignite client. Strangely, I can set just a datetime, but then
>>>>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>>>>> suggestions?
>>>>>
>>>>>
>>>>>
>>>>>     db.sql(query, query_args=[converted_row[c] for c in
>>>>> table.column_names])
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>>>>> line 401, in sql
>>>>>     max_rows, timeout,
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>>>>> line 370, in sql_fields
>>>>>     'include_field_names': include_field_names,
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>>>>> line 260, in from_python
>>>>>     buffer += c_type.from_python(values[name])
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>> line 471, in from_python
>>>>>     buffer += infer_from_python(x)
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>>> line 399, in infer_from_python
>>>>>     if is_hinted(value):
>>>>>   File
>>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>>>>> line 51, in is_hinted
>>>>>     and issubclass(value[1], IgniteDataType)
>>>>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>>>>     return _abc_subclasscheck(cls, subclass)
>>>>> TypeError: issubclass() arg 1 must be a class
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Stéphane Thibaud
>>>>>
>>>>>
>>>>>

Re: Timestamp with Python thin client

Posted by Igor Sapego <is...@apache.org>.
I believe, it's OK to pass tuple for timestamp in python, but you also
should
add a tip for the client to inform it you are going to store timestamp
value.

Take a look at tests for example: [1]

1 -
https://github.com/apache/ignite/blob/master/modules/platforms/python/tests/test_datatypes.py#L80

Best Regards,
Igor


On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <sn...@gmail.com>
wrote:

> Thank you. I will try to create a code line to reproduce it, but I
> remember the following: when you do a 'select' query on a timestamp column
> with the Python thin client, you get a tuple. Because of that, I assumed
> that a tuple also had to be written in an update query.
>
>
> Kind regards,
>
> Stéphane Thibaud
>
> 2019年5月15日(水) 17:59 Igor Sapego <is...@apache.org>:
>
>> Stéphane,
>>
>> Can you sharer a code line, how do you try to store timestamp value?
>>
>> Best Regards,
>> Igor
>>
>>
>> On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <dm...@gmail.com>
>> wrote:
>>
>>> Stéphane,
>>>
>>> Could you provide the code, that results in this exception?
>>> Do you try to insert the tuple as a single field via SQL? There is no
>>> such primitive as a tuple in SQL, so you should probably split timestamp
>>> into datetime and nanoseconds columns and store them separately as two
>>> different columns.
>>>
>>> Denis
>>>
>>> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>>>
>>>> Hello Apache users,
>>>>
>>>> I am running into the following issue: when I try to store a timestamp
>>>> with nanosecond precision with the Python Thin client, I get the stack
>>>> trace below. I have specified the timestamp as a tuple of (datetime,
>>>> nanoseconds) as that is the format in which I also get timestamps back from
>>>> the apache ignite client. Strangely, I can set just a datetime, but then
>>>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>>>> suggestions?
>>>>
>>>>
>>>>
>>>>     db.sql(query, query_args=[converted_row[c] for c in
>>>> table.column_names])
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>>>> line 401, in sql
>>>>     max_rows, timeout,
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>>>> line 370, in sql_fields
>>>>     'include_field_names': include_field_names,
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>>>> line 260, in from_python
>>>>     buffer += c_type.from_python(values[name])
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>> line 471, in from_python
>>>>     buffer += infer_from_python(x)
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>>> line 399, in infer_from_python
>>>>     if is_hinted(value):
>>>>   File
>>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>>>> line 51, in is_hinted
>>>>     and issubclass(value[1], IgniteDataType)
>>>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>>>     return _abc_subclasscheck(cls, subclass)
>>>> TypeError: issubclass() arg 1 must be a class
>>>>
>>>> Kind regards,
>>>>
>>>> Stéphane Thibaud
>>>>
>>>>
>>>>

Re: Timestamp with Python thin client

Posted by Stéphane Thibaud <sn...@gmail.com>.
Thank you. I will try to create a code line to reproduce it, but I remember
the following: when you do a 'select' query on a timestamp column with the
Python thin client, you get a tuple. Because of that, I assumed that a
tuple also had to be written in an update query.


Kind regards,

Stéphane Thibaud

2019年5月15日(水) 17:59 Igor Sapego <is...@apache.org>:

> Stéphane,
>
> Can you sharer a code line, how do you try to store timestamp value?
>
> Best Regards,
> Igor
>
>
> On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <dm...@gmail.com>
> wrote:
>
>> Stéphane,
>>
>> Could you provide the code, that results in this exception?
>> Do you try to insert the tuple as a single field via SQL? There is no
>> such primitive as a tuple in SQL, so you should probably split timestamp
>> into datetime and nanoseconds columns and store them separately as two
>> different columns.
>>
>> Denis
>>
>> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>>
>>> Hello Apache users,
>>>
>>> I am running into the following issue: when I try to store a timestamp
>>> with nanosecond precision with the Python Thin client, I get the stack
>>> trace below. I have specified the timestamp as a tuple of (datetime,
>>> nanoseconds) as that is the format in which I also get timestamps back from
>>> the apache ignite client. Strangely, I can set just a datetime, but then
>>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>>> suggestions?
>>>
>>>
>>>
>>>     db.sql(query, query_args=[converted_row[c] for c in
>>> table.column_names])
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>>> line 401, in sql
>>>     max_rows, timeout,
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>>> line 370, in sql_fields
>>>     'include_field_names': include_field_names,
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>>> line 260, in from_python
>>>     buffer += c_type.from_python(values[name])
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>> line 471, in from_python
>>>     buffer += infer_from_python(x)
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>>> line 399, in infer_from_python
>>>     if is_hinted(value):
>>>   File
>>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>>> line 51, in is_hinted
>>>     and issubclass(value[1], IgniteDataType)
>>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>>     return _abc_subclasscheck(cls, subclass)
>>> TypeError: issubclass() arg 1 must be a class
>>>
>>> Kind regards,
>>>
>>> Stéphane Thibaud
>>>
>>>
>>>

Re: Timestamp with Python thin client

Posted by Igor Sapego <is...@apache.org>.
Stéphane,

Can you sharer a code line, how do you try to store timestamp value?

Best Regards,
Igor


On Tue, May 14, 2019 at 7:23 PM Denis Mekhanikov <dm...@gmail.com>
wrote:

> Stéphane,
>
> Could you provide the code, that results in this exception?
> Do you try to insert the tuple as a single field via SQL? There is no such
> primitive as a tuple in SQL, so you should probably split timestamp into
> datetime and nanoseconds columns and store them separately as two different
> columns.
>
> Denis
>
> сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:
>
>> Hello Apache users,
>>
>> I am running into the following issue: when I try to store a timestamp
>> with nanosecond precision with the Python Thin client, I get the stack
>> trace below. I have specified the timestamp as a tuple of (datetime,
>> nanoseconds) as that is the format in which I also get timestamps back from
>> the apache ignite client. Strangely, I can set just a datetime, but then
>> the nanoseconds become zero. Am I doing it in the wrong way? Any
>> suggestions?
>>
>>
>>
>>     db.sql(query, query_args=[converted_row[c] for c in
>> table.column_names])
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
>> line 401, in sql
>>     max_rows, timeout,
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
>> line 370, in sql_fields
>>     'include_field_names': include_field_names,
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
>> line 260, in from_python
>>     buffer += c_type.from_python(values[name])
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>> line 471, in from_python
>>     buffer += infer_from_python(x)
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
>> line 399, in infer_from_python
>>     if is_hinted(value):
>>   File
>> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
>> line 51, in is_hinted
>>     and issubclass(value[1], IgniteDataType)
>>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>>     return _abc_subclasscheck(cls, subclass)
>> TypeError: issubclass() arg 1 must be a class
>>
>> Kind regards,
>>
>> Stéphane Thibaud
>>
>>
>>

Re: Timestamp with Python thin client

Posted by Denis Mekhanikov <dm...@gmail.com>.
Stéphane,

Could you provide the code, that results in this exception?
Do you try to insert the tuple as a single field via SQL? There is no such
primitive as a tuple in SQL, so you should probably split timestamp into
datetime and nanoseconds columns and store them separately as two different
columns.

Denis

сб, 4 мая 2019 г. в 10:39, Stéphane Thibaud <sn...@gmail.com>:

> Hello Apache users,
>
> I am running into the following issue: when I try to store a timestamp
> with nanosecond precision with the Python Thin client, I get the stack
> trace below. I have specified the timestamp as a tuple of (datetime,
> nanoseconds) as that is the format in which I also get timestamps back from
> the apache ignite client. Strangely, I can set just a datetime, but then
> the nanoseconds become zero. Am I doing it in the wrong way? Any
> suggestions?
>
>
>
>     db.sql(query, query_args=[converted_row[c] for c in
> table.column_names])
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/client.py",
> line 401, in sql
>     max_rows, timeout,
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/api/sql.py",
> line 370, in sql_fields
>     'include_field_names': include_field_names,
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/queries/__init__.py",
> line 260, in from_python
>     buffer += c_type.from_python(values[name])
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
> line 471, in from_python
>     buffer += infer_from_python(x)
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/datatypes/internal.py",
> line 399, in infer_from_python
>     if is_hinted(value):
>   File
> "/home/snthibaud/PycharmProjects/tabee/venv/lib/python3.7/site-packages/pyignite/utils.py",
> line 51, in is_hinted
>     and issubclass(value[1], IgniteDataType)
>   File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
>     return _abc_subclasscheck(cls, subclass)
> TypeError: issubclass() arg 1 must be a class
>
> Kind regards,
>
> Stéphane Thibaud
>
>
>