From 88f53f23a69c8ce921de09fab7a6bf8bb8fe447a Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 16:27:50 +0700 Subject: [PATCH 1/6] wip --- tests/test_influxdb_client_3_integration.py | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index 554a971..afb0212 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -10,7 +10,7 @@ from urllib3.exceptions import MaxRetryError, TimeoutError as Url3TimeoutError from influxdb_client_3 import InfluxDBClient3, write_client_options, WriteOptions, \ - WriteType, InfluxDB3ClientQueryError + WriteType, InfluxDB3ClientQueryError, Point from influxdb_client_3.exceptions import InfluxDBError from tests.util import asyncio_run, lp_to_py_object @@ -48,6 +48,29 @@ def tearDown(self): if self.client: self.client.close() + def test_write_batch_and_query(self): + write_options=WriteOptions(batch_size=100) + # write_options=WriteOptions(write_type=WriteType.synchronous) + wco = write_client_options(write_options=write_options) + c = InfluxDBClient3( + host=self.host, + database=self.database, + token=self.token, + write_client_options=wco) + + test_id = time.time_ns() + p = Point.measurement("integration_test_python14").tag("type", "used").field("value", 123.0) + # c.write(f"integration_test_python6,type=used value=123.0,test_id={test_id}i") + self.client.write(record=p) + + sql = 'SELECT * FROM integration_test_python14' + df = self.client.query(query=sql) + + self.assertIsNotNone(df) + # self.assertEqual(1, len(df)) + # self.assertEqual(test_id, df['test_id'][0]) + # self.assertEqual(123.0, df['value'][0]) + def test_write_and_query(self): test_id = time.time_ns() self.client.write(f"integration_test_python,type=used value=123.0,test_id={test_id}i") From 0d83dde64d541f7f7d67b331dc2db4566d6e272c Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 16:43:14 +0700 Subject: [PATCH 2/6] wip --- tests/test_influxdb_client_3_integration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index afb0212..5a0296d 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -1,12 +1,12 @@ import logging import os -import pyarrow -import pytest import random import string import time import unittest +import pyarrow +import pytest from urllib3.exceptions import MaxRetryError, TimeoutError as Url3TimeoutError from influxdb_client_3 import InfluxDBClient3, write_client_options, WriteOptions, \ @@ -59,11 +59,11 @@ def test_write_batch_and_query(self): write_client_options=wco) test_id = time.time_ns() - p = Point.measurement("integration_test_python14").tag("type", "used").field("value", 123.0) + p = Point.measurement("integration_test_python17").tag("type", "used").field("value", 123.0) # c.write(f"integration_test_python6,type=used value=123.0,test_id={test_id}i") self.client.write(record=p) - sql = 'SELECT * FROM integration_test_python14' + sql = 'SELECT * FROM integration_test_python17' df = self.client.query(query=sql) self.assertIsNotNone(df) From 235e6db3fb54b66b87c46585ad15c598ea9a6637 Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 16:58:54 +0700 Subject: [PATCH 3/6] wip --- tests/test_influxdb_client_3_integration.py | 36 ++++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index 5a0296d..57bd365 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -40,7 +40,13 @@ def setUp(self): self.host = os.getenv('TESTING_INFLUXDB_URL') self.token = os.getenv('TESTING_INFLUXDB_TOKEN') self.database = os.getenv('TESTING_INFLUXDB_DATABASE') - self.client = InfluxDBClient3(host=self.host, database=self.database, token=self.token) + write_options=WriteOptions(batch_size=100) + wco = write_client_options(write_options=write_options) + self.client = InfluxDBClient3( + host=self.host, + database=self.database, + token=self.token, + write_client_options=wco) def tearDown(self): self._caplog.clear() @@ -49,27 +55,25 @@ def tearDown(self): self.client.close() def test_write_batch_and_query(self): - write_options=WriteOptions(batch_size=100) + # write_options=WriteOptions(batch_size=100) # write_options=WriteOptions(write_type=WriteType.synchronous) - wco = write_client_options(write_options=write_options) - c = InfluxDBClient3( - host=self.host, - database=self.database, - token=self.token, - write_client_options=wco) + # wco = write_client_options(write_options=write_options) + # c = InfluxDBClient3( + # host='http://localhost:8181', + # database=self.database, + # token='apiv3_XI_7D1lsUv0CsVoPiWQJtzG51LE-roQLF64pkKRxOi3cVdAFRfoBIJjptTjDordcOGa-rYe1Dow-iRsv9yU4ZA', + # write_client_options=wco) test_id = time.time_ns() - p = Point.measurement("integration_test_python17").tag("type", "used").field("value", 123.0) - # c.write(f"integration_test_python6,type=used value=123.0,test_id={test_id}i") - self.client.write(record=p) + self.client.write(f"integration_test_python21,type=used value=123.0,test_id={test_id}i") - sql = 'SELECT * FROM integration_test_python17' - df = self.client.query(query=sql) + sql = 'SELECT * FROM integration_test_python21 where type=$type and test_id=$test_id' + df = self.client.query(sql, mode="pandas", query_parameters={'type': 'used', 'test_id': test_id}) self.assertIsNotNone(df) - # self.assertEqual(1, len(df)) - # self.assertEqual(test_id, df['test_id'][0]) - # self.assertEqual(123.0, df['value'][0]) + self.assertEqual(1, len(df)) + self.assertEqual(test_id, df['test_id'][0]) + self.assertEqual(123.0, df['value'][0]) def test_write_and_query(self): test_id = time.time_ns() From f03a47baea2dbbe8d9b4ff30c80497f6dcac4c90 Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 17:10:14 +0700 Subject: [PATCH 4/6] wip --- tests/test_influxdb_client_3_integration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index 57bd365..cfb020e 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -40,7 +40,8 @@ def setUp(self): self.host = os.getenv('TESTING_INFLUXDB_URL') self.token = os.getenv('TESTING_INFLUXDB_TOKEN') self.database = os.getenv('TESTING_INFLUXDB_DATABASE') - write_options=WriteOptions(batch_size=100) + # write_options=WriteOptions(batch_size=100) + write_options=WriteOptions(write_type=WriteType.synchronous) wco = write_client_options(write_options=write_options) self.client = InfluxDBClient3( host=self.host, From b558f972e1d00365088355a8d232eba65ace7bbb Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 17:19:51 +0700 Subject: [PATCH 5/6] wip --- tests/test_influxdb_client_3_integration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index cfb020e..c3490e3 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -40,8 +40,8 @@ def setUp(self): self.host = os.getenv('TESTING_INFLUXDB_URL') self.token = os.getenv('TESTING_INFLUXDB_TOKEN') self.database = os.getenv('TESTING_INFLUXDB_DATABASE') - # write_options=WriteOptions(batch_size=100) - write_options=WriteOptions(write_type=WriteType.synchronous) + write_options=WriteOptions(batch_size=100) + # write_options=WriteOptions(write_type=WriteType.synchronous) wco = write_client_options(write_options=write_options) self.client = InfluxDBClient3( host=self.host, From e2324ff23fce8d784b790fdb74149b408c913c9e Mon Sep 17 00:00:00 2001 From: NguyenHoangSon96 Date: Thu, 15 Jan 2026 17:20:13 +0700 Subject: [PATCH 6/6] wip --- tests/test_influxdb_client_3_integration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_influxdb_client_3_integration.py b/tests/test_influxdb_client_3_integration.py index c3490e3..076dbd1 100644 --- a/tests/test_influxdb_client_3_integration.py +++ b/tests/test_influxdb_client_3_integration.py @@ -66,9 +66,9 @@ def test_write_batch_and_query(self): # write_client_options=wco) test_id = time.time_ns() - self.client.write(f"integration_test_python21,type=used value=123.0,test_id={test_id}i") + self.client.write(f"integration_test_python22,type=used value=123.0,test_id={test_id}i") - sql = 'SELECT * FROM integration_test_python21 where type=$type and test_id=$test_id' + sql = 'SELECT * FROM integration_test_python22 where type=$type and test_id=$test_id' df = self.client.query(sql, mode="pandas", query_parameters={'type': 'used', 'test_id': test_id}) self.assertIsNotNone(df)