Skip to content
Queria Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Hand data to BI tools and notebooks

Save SQL results filtered to what you need as Parquet or CSV, and open them in Tableau, Excel or pandas

Filter Queria data down to the rows and columns you need with the Queria CLI and save it as Parquet or CSV, and you can open the file in Tableau, Excel, pandas and other tools. The tools that open the file need no connector or driver.

Filter, then save

Narrow the data to the columns and rows you need with SQL, then save it to a file with --out.

queria sql "
  SELECT area_name, year, value AS population
  FROM e_stat.ssds.a_pref_population
  WHERE item_name = 'A1101_総人口' AND year >= 2015
" --out population.parquet

With a .csv extension, it saves CSV. The smaller the file, the faster the tool that opens it.

Open in Tableau

Tableau Desktop opens CSV as a text file. Version 2024.2 or later also opens Parquet.

When loading a new file for every update becomes a chore, connect from Tableau Desktop directly. When the dataset is updated, Tableau gets the new data too.

Open in Excel or spreadsheets

Saved as CSV, the file opens in Excel or Google Sheets.

queria sql "SELECT ..." --out monthly.csv

Read with pandas or Polars

In a notebook, read the saved Parquet with pandas or a similar library. The queria package is not needed.

import pandas as pd

df = pd.read_parquet("population.parquet")

To run SQL from the notebook directly, use conn.sql(...).df() from the Python API to get the results as a DataFrame.

Keep how it was made

When you hand over only the file, nobody can tell later which SQL produced it. Keep the command that made the file as a script next to it, so others can make the same file again.

#!/usr/bin/env bash
# make-population.sh — how population.parquet is produced
queria sql "
  SELECT area_name, year, value AS population
  FROM e_stat.ssds.a_pref_population
  WHERE item_name = 'A1101_総人口' AND year >= 2015
" --out population.parquet

To remake it on a schedule, register this script with cron. See Embed in shell pipelines.

Was this page helpful?