Empty string in database becomes None value in Python
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện Python với truy vấn Flux được hiển thị và so sánh các giá trị _value mong đợi với giá trị thực tế. Theo dõi cách query_api().query(q) phân tích bản ghi được trả về, sau đó xác minh rằng một chuỗi rỗng vẫn là "" thay vì trở thành None trong kết quả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Specifications
- Client Version: 1.34.0
- InfluxDB Version: 2.6.1
- Platform: Linux
Code sample to reproduce problem
import influxdb_client
with influxdb_client.InfluxDBClient(
org = ...,
token = ...,
url = ...,
) as client:
q = f"""
from(bucket: ...)
//|> filter(fn: (r) => exists r._value)
//|> filter(fn: (r) => r._value != "")
|> last()
"""
res = [
record_it.values
for table_it in client.query_api().query(q)
for record_it in table_it.records
]
print(res)
Expected behavior
[{'result': '_result', 'table': 0, '_time': datetime.datetime(2023, 3, 2, 18, 47, 7, 547036, tzinfo=tzutc()), '_value': ''}]
Actual behavior
[{'result': '_result', 'table': 0, '_time': datetime.datetime(2023, 3, 2, 18, 47, 7, 547036, tzinfo=tzutc()), '_value': None}]
Additional info
If [
_value] column is null in the last record, last() returns the previous record with a non-null value.
My last record with a non-null _value has the empty string for _value.
So far, the row is correctly identified.
But by the time I read _value from the result returned in Python, the record does not hold the empty string "" but None.
I verified that the value of _value is really the empty string in the database and not None by experimenting with filters (see commented code).
I find it more intuitive to leave the empty string as empty string in Python.
- Ngôn ngữ chính
- Python
- Star
- 792
- Fork
- 186
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của influxdata/influxdb-client-python
-
Pandas outputs warning when calling dataframe.append in flux_csv_parser._prepare_data_frameCó thể đã có người làm @dave-cz đã nhận 409 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
influxdata/influxdb-client-python#613 · 7 bình luận ·
-
ApiClient.__del__ triggers shutdown-time exception in influxdb-client 1.50.0Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
influxdata/influxdb-client-python#719 · 1 người được giao ·
-
Public symbols not properly exported with `py.typed` present — triggers Pylance/Pyright errorsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
influxdata/influxdb-client-python#694 · 6 reaction ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
influxdata/influxdb-client-python#693 · 2 bình luận · 1 reaction ·
-
Socks proxy supportĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của influxdata/influxdb-client-python
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
adri0/scadustats#128 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`TIMESTAMP`, `TIMESTAMP_NTZ`, `TINYINT` and the other `TypeDecorator`s don't declare `python_type`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
RPBCĐang mởawaiting policy acceptance precheck-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Bioconductor/BiocContributions#240 · 1 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue launch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
FlologixAI/etchwork#4 ·