Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

PROC FSQL — federation & migration examples

PROC FSQL is Jenner's DataFusion-native SQL engine. One statement joins data that lives in different systems and formats — a database table, avro/parquet/csv files, and objects in cloud storage — and returns a single result set.

This repository is a hands-on tour: runnable notebooks for real data-migration and federation use cases, plus scripts that stand up the sample databases so every example works end to end. Everything is provided in 15 languages, with the SAS-style keywords, comments, and identifiers localized in each.

New to FSQL? Start with the PROC FSQL reference.

Why FSQL

PROC FSQL
Join a database table with a flat file✅ one statement
Read avro / parquet / csv directly
Read cloud object storage (s3://, gs://, https://)
Two different databases in one query
Window functions, CTEs, recursive CTEs
CREATE TABLE to avro / parquet / csv

The sample scenario

A deliberately scattered multi-site clinical trial — the kind of setup that makes federation and migration necessary. Each table lives in a different system:

TableLives inRepresents
subjectsPostgreSQLthe EDC / demographics system
labsMySQL (and a local SQLite copy)the central-lab system
sitesSQLitea local reference database
adverse_eventsparquet (and MinIO/S3)a data-lake extract
visitscsva site-provided flat file
exposureavroJenner's native store

All tables key on usubjid (subject) and siteid (site), so they join cleanly wherever they physically live.

Quick start

Requirements: python3 and the jenner binary on your PATH. The cloud and server examples also need Docker and a jenner built with the s3 feature.

git clone https://github.com/JennerAnalytics/fsql.git
cd fsql
# Local sources only (no servers needed): builds data/ with# csv, avro, parquet, and SQLite databases.
./setup/setup.sh
# ...or also start PostgreSQL, MySQL, and MinIO and load them:
./setup/setup.sh --with-servers
# Open the notebooks (launch from the repo root):
jupyter lab # then browse notebooks/en/

setup.py is the Python equivalent of setup.sh for the same steps.

Notebooks

Under notebooks/en/ (English) and i18n/<lang>/ (localized):

#NotebookShows
101_migrate_database_to_avroMigrate a database table into Jenner's avro store
202_convert_file_formatsConvert between csv, parquet, and avro
303_federate_file_and_databaseJoin a flat file with a database table in one query
404_reconcile_two_databasesReconcile PostgreSQL against MySQL
505_federate_cloud_and_localJoin a cloud (S3) object with local sources
606_analytics_across_sourcesWindow functions and CTEs over federated data
707_operate_and_tune_federated_queriesIntrospect with DICTIONARY, PROFILE a step, edit locally with DML, write partitioned parquet, and reuse connections

Notebooks that use only local sources (1, 2, 3, 6, 7) run after ./setup/setup.sh. Notebooks 4 and 5 use the servers — run ./setup/setup.sh --with-servers first, and for notebook 5 use a jenner built with --features s3 with these set:

export JENNER_S3_ENDPOINT=http://localhost:9000
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
export JENNER_FSQL_URI_ALLOWLIST=localhost # for inline database URIs

Languages

Every notebook is provided in 15 languages under i18n/:

cs da de el es fi fr it ja ko nl pl pt sv zh

Each localized notebook has its SAS-style keywords translated into that language's tokens (via jenner translate), comments and narrative in that language, and variable, table, and database names chosen to read naturally in the language.

Layout

setup/ seed.py, build_files.jenner, setup.sh/.py, docker-compose.yml
data/ generated by setup (git-ignored)
notebooks/ en/ the English notebooks
i18n/ <lang>/ localized notebooks

License

MIT. Sample data is synthetic.

About

PROC FSQL — DataFusion-native federated SQL for Jenner: examples, data-migration & federation notebooks, and DB setup scripts (multilingual)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages