import pyarrow as pya
from pyarrow import orc
from glob import glob
import duckdb
conn = duckdb.connect(database='python_db.duckdb')
# Read orc file using pyarrow
orc_filepath = 'ORC file path'
with open(orc_filepath,'rb') as orc_file:
table = orc.ORCFile(orc_file).read()
# Register the Pyarrow Table in DuckDB As View
conn.register('orc_table',table)
# Query the view
conn.execute("SELECT * FROM orc_table;").df()