Preview:
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()
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter