Timestamp with Python thin client

classic Classic list List threaded Threaded
8 messages Options
Stéphane Thibaud-2 Stéphane Thibaud-2
Reply | Threaded
Open this post in threaded view
|

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


Denis Mekhanikov Denis Mekhanikov
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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 <[hidden email]>:
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


Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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 <[hidden email]> 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 <[hidden email]>:
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


Stéphane Thibaud-2 Stéphane Thibaud-2
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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


Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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]


Best Regards,
Igor


On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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


Stéphane Thibaud-2 Stéphane Thibaud-2
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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 <[hidden email]>:
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]


Best Regards,
Igor


On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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


Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

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.



Best Regards,
Igor



On Thu, May 16, 2019 at 9:02 AM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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]


Best Regards,
Igor


On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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


Stéphane Thibaud-2 Stéphane Thibaud-2
Reply | Threaded
Open this post in threaded view
|

Re: Timestamp with Python thin client

Thank you very much. It is completely clear to me now.


Kind regards,

Stéphane Thibaud

2019年5月17日(金) 20:56 Igor Sapego <[hidden email]>:
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.



Best Regards,
Igor



On Thu, May 16, 2019 at 9:02 AM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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]


Best Regards,
Igor


On Wed, May 15, 2019 at 12:24 PM Stéphane Thibaud <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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