Skip to content

Sender.row() should allow insertion of NULL values using python None value #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
salsasepp opened this issue Jul 19, 2022 · 1 comment · Fixed by #5
Closed

Sender.row() should allow insertion of NULL values using python None value #3

salsasepp opened this issue Jul 19, 2022 · 1 comment · Fixed by #5
Assignees

Comments

@salsasepp
Copy link

Describe the bug

When specifying None for a column value in Sender.row(), I see this error message:

Traceback (most recent call last):
File "reproduce.py", line 7, in <module>
    sender.row('test',
  File "src/questdb/ingress.pyx", line 1237, in questdb.ingress.Sender.row
  File "src/questdb/ingress.pyx", line 719, in questdb.ingress.Buffer.row
  File "src/questdb/ingress.pyx", line 654, in questdb.ingress.Buffer._row
  File "src/questdb/ingress.pyx", line 649, in questdb.ingress.Buffer._row
  File "src/questdb/ingress.pyx", line 583, in questdb.ingress.Buffer._column
TypeError: Unsupported type: <class 'NoneType'>. Must be one of: bool, int, float, str, TimestampMicros, datetime.datetime

To reproduce

Web console:

CREATE TABLE test(data STRING)

reproduce.py:

from questdb.ingress import Sender

with Sender('localhost', 9009) as sender:
    # This works as expected:
    sender.row('test',
        columns={'data': 'somedata'}
    )
    # This fails:
    sender.row('test',
        columns={'data': None}
    )
    sender.flush()

Expected behaviour:

I would expect a NULL value to be inserted into the table when I specify None.

I am aware that I can work around this issue by leaving out the column I want to NULL from the columns parameter. However it would be nice if the client library would take care of that. Also, such a workaround fails if the column to be nulled is the only one or if I want to null all columns ("questdb.ingress.IngressError: Must specify at least one symbol or column").

Environment

Linux desktop 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
questdb-6.4.3-rt-linux-amd64
Python 3.10.4

@marregui marregui self-assigned this Jul 20, 2022
@marregui
Copy link
Contributor

Hi @salsasepp thank you for the report, sure, will get done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants