File 0001-Detect-if-orc-file-format-is-supported.patch of Package python-influxdb3-python

From 8454654a4e591123b9f2da7b75c5aca9ec2ca656 Mon Sep 17 00:00:00 2001
From: Frank Kunz <mailinglists@kunz-im-inter.net>
Date: Mon, 8 Sep 2025 19:08:17 +0200
Subject: [PATCH] Detect if orc file format is supported

Signed-off-by: Frank Kunz <mailinglists@kunz-im-inter.net>
---
 influxdb_client_3/read_file.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/influxdb_client_3/read_file.py b/influxdb_client_3/read_file.py
index 6f9f5e5..b9d5397 100644
--- a/influxdb_client_3/read_file.py
+++ b/influxdb_client_3/read_file.py
@@ -3,9 +3,12 @@ import pyarrow.csv as csv
 import pyarrow.feather as feather
 import pyarrow.parquet as parquet
 
-# Check if the OS is not Windows
-if os.name != 'nt':
+# Check if orc module can be loaded
+try:
     import pyarrow.orc as orc
+    pyarrow_osc_support = True
+except ImportError:
+    pyarrow_osc_support = False
 
 
 class UploadFile:
@@ -84,8 +87,9 @@ class UploadFile:
         :return: The loaded ORC file.
         :raises ValueError: If the OS is Windows.
         """
-        if os.name == 'nt':
-            raise ValueError("Unsupported file type for this OS")
+        global pyarrow_osc_support
+        if not pyarrow_osc_support:
+            raise ValueError("Unsupported file type orc for this OS")
         else:
             return orc.read_table(file, **self._kwargs)
 
-- 
2.51.0

openSUSE Build Service is sponsored by