Skip to content

Commit 38e9fcb

Browse files
Merge pull request #35 from InfluxCommunity/windows
Windows
2 parents 4c56987 + fe5b689 commit 38e9fcb

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Examples/file-import/orc_write.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import influxdb_client_3 as InfluxDBClient3
22
import pandas as pd
33
import numpy as np
4-
from influxdb_client_3 import write_client_options, WritePrecision, WriteOptions, InfluxDBError
4+
from influxdb_client_3 import write_client_options, WriteOptions, InfluxDBError
55

66

77
class BatchingCallback(object):
@@ -35,7 +35,7 @@ def retry(self, conf, data: str, exception: InfluxDBError):
3535
token="INSERT_TOKEN",
3636
host="eu-central-1-1.aws.cloud2.influxdata.com",
3737
org="6a841c0c08328fb1",
38-
database="python", _write_client_options=wco) as client:
38+
database="python") as client:
3939

4040

4141

influxdb_client_3/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
def write_client_options(**kwargs):
1313
return kwargs
1414

15+
def default_client_options(**kwargs):
16+
return kwargs
1517

1618
def flight_client_options(**kwargs):
1719
return kwargs # You can replace this with a specific data structure if needed
@@ -45,7 +47,7 @@ def __init__(
4547
"""
4648
self._org = org
4749
self._database = database
48-
self._write_client_options = write_client_options or write_client_options(write_options=SYNCHRONOUS)
50+
self._write_client_options = write_client_options if write_client_options is not None else default_client_options(write_options=SYNCHRONOUS)
4951

5052
# Extracting the hostname from URL if provided
5153
parsed_url = urllib.parse.urlparse(host)

influxdb_client_3/read_file.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import pyarrow.csv as csv
33
import pyarrow.feather as feather
44
import pyarrow.parquet as parquet
5-
import pyarrow.orc as orc
5+
import os
6+
7+
# Check if the OS is not Windows
8+
if os.name != 'nt':
9+
import pyarrow.orc as orc
10+
611
import pandas as pd
712

813
class upload_file:
@@ -20,6 +25,7 @@ def load_file(self):
2025
elif self._file.endswith(".json"):
2126
return self.load_json(self._file)
2227
elif self._file.endswith(".orc"):
28+
2329
return self.load_orc(self._file)
2430
else:
2531
raise ValueError("Unsupported file type")
@@ -34,7 +40,10 @@ def load_csv(self, file):
3440
return csv.read_csv(file, **self._kwargs)
3541

3642
def load_orc(self, file):
37-
return orc.read_table(file, **self._kwargs)
43+
if os.name == 'nt':
44+
raise ValueError("Unsupported file type for this OS")
45+
else:
46+
return orc.read_table(file, **self._kwargs)
3847

3948
#TODO: Use pyarrow.json.read_json() instead of pandas.read_json()
4049
def load_json(self, file):

0 commit comments

Comments
 (0)