|
11 | 11 | from influxdb_client import Point, WritePrecision, BucketsService |
12 | 12 | from influxdb_client.client.exceptions import InfluxDBError |
13 | 13 | from influxdb_client.client.influxdb_client_async import InfluxDBClientAsync |
| 14 | +from influxdb_client.client.query_api import QueryOptions |
14 | 15 | from influxdb_client.client.warnings import MissingPivotFunction |
15 | 16 | from tests.base_test import generate_name |
16 | 17 |
|
@@ -312,6 +313,48 @@ async def test_query_and_debug(self): |
312 | 313 | results = await buckets_service.get_buckets() |
313 | 314 | self.assertIn("my-bucket", list(map(lambda bucket: bucket.name, results.buckets))) |
314 | 315 |
|
| 316 | + @async_test |
| 317 | + @aioresponses() |
| 318 | + async def test_parse_csv_with_new_lines_in_column(self, mocked): |
| 319 | + await self.client.close() |
| 320 | + self.client = InfluxDBClientAsync("http://localhost") |
| 321 | + mocked.post('http://localhost/api/v2/query?org=my-org', status=200, body='''#datatype,string,long,dateTime:RFC3339 |
| 322 | +#group,false,false,false |
| 323 | +#default,_result,, |
| 324 | +,result,table,_time |
| 325 | +,,0,2022-09-09T10:22:13.744147091Z |
| 326 | +
|
| 327 | +#datatype,string,long,string,long,long,long,long,long,long,long,long,long,string,long,long,string |
| 328 | +#group,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false |
| 329 | +#default,_profiler,,,,,,,,,,,,,,, |
| 330 | +,result,table,_measurement,TotalDuration,CompileDuration,QueueDuration,PlanDuration,RequeueDuration,ExecuteDuration,Concurrency,MaxAllocated,TotalAllocated,RuntimeErrors,influxdb/scanned-bytes,influxdb/scanned-values,flux/query-plan |
| 331 | +,,0,profiler/query,17305459,6292042,116958,0,0,10758125,0,448,0,,0,0,"digraph { |
| 332 | + ""ReadRange4"" |
| 333 | + ""keep2"" |
| 334 | + ""limit3"" |
| 335 | +
|
| 336 | + ""ReadRange4"" -> ""keep2"" |
| 337 | + ""keep2"" -> ""limit3"" |
| 338 | +} |
| 339 | +
|
| 340 | +" |
| 341 | +
|
| 342 | +#datatype,string,long,string,string,string,long,long,long,long,double |
| 343 | +#group,false,false,true,false,false,false,false,false,false,false |
| 344 | +#default,_profiler,,,,,,,,, |
| 345 | +,result,table,_measurement,Type,Label,Count,MinDuration,MaxDuration,DurationSum,MeanDuration |
| 346 | +,,1,profiler/operator,*influxdb.readFilterSource,ReadRange4,1,888209,888209,888209,888209 |
| 347 | +,,1,profiler/operator,*universe.schemaMutationTransformation,keep2,4,1875,42042,64209,16052.25 |
| 348 | +,,1,profiler/operator,*universe.limitTransformation,limit3,3,1333,38750,47874,15958''') |
| 349 | + |
| 350 | + records = [] |
| 351 | + await self.client\ |
| 352 | + .query_api(QueryOptions(profilers=["operator", "query"], |
| 353 | + profiler_callback=lambda record: records.append(record))) \ |
| 354 | + .query("buckets()", "my-org") |
| 355 | + |
| 356 | + self.assertEqual(4, len(records)) |
| 357 | + |
315 | 358 | async def _prepare_data(self, measurement: str): |
316 | 359 | _point1 = Point(measurement).tag("location", "Prague").field("temperature", 25.3) |
317 | 360 | _point2 = Point(measurement).tag("location", "New York").field("temperature", 24.3) |
|
0 commit comments