Omniscope Custom Blocks › Outputs/GitHub

GitHub

Reads a CSV or other delimited file from a GitHub repository into records, or writes the input records to a file in a repository as a new commit.

Outputs › GitHub Python

Open the demo in Omniscope Download demo.ioz Sample data: placeholder.csv Source on GitHub

Omniscope custom block · Outputs

A reference table kept in a GitHub repository, read straight into the workflow; or the workflow's result committed back, one versioned commit per run.

Python · requests, pandas · requests installed on first run if missing

The problem it solves

Teams keep small, carefully reviewed tables in GitHub: targets, mappings, price lists, open datasets. Reading them into a workflow by hand means downloading a file that is out of date as soon as someone merges a change. And publishing a workflow's result to a repository (a dataset others build on, or a file a website reads) usually means a manual upload with no record of what changed when.

This block reads the file through GitHub's API on each run, or writes the input as one commit on a branch, with a message, and reports the commit it made.

How it works

What goes in

To read: nothing from the workflow. To write: the records to save. The demo reads an invented file of monthly orders and revenue for six regions, served in the tests by a stand-in for GitHub; sample-data/placeholder.csv is that file, which is exactly what the block outputs for it.

The options

Option Demo setting What it does
Access token (empty) Not needed to read a public repository.
Mode Read a file from GitHub Read the file, or write the input as a commit.
zlib-compressed file unticked For files stored compressed with zlib.
Separator , The field separator; \t for tab.
Repository path octo-org/sales-data The repository, or its address.
File path data/monthly-sales.csv The file within the repository.
Branch (empty) The repository's default branch.
Commit message (empty) Writing only: "Update data/monthly-sales.csv from Omniscope".

What comes out

Read: the file's records (first 6)

Month Region Orders Revenue
2025-01 North 311 18279.90
2025-01 Midlands 318 15532.38
2025-01 South East 380 16171.91
2025-01 South West 342 16901.06
2025-01 Scotland 394 22470.39
2025-01 Wales 128 6235.93

36 records in all, 8,829 orders. Orders comes out as whole numbers and Revenue as decimals.

Write: the commit made

Repository Branch File path Records written Commit Commit URL
octo-org/sales-data main data/monthly-sales.csv 36 c0ffee1234567890 https://github.com/octo-org/sales-data/commit/c0ffee1234567890

(From the tests' stand-in for GitHub; a real commit id is 40 characters.)

Where it pays off

Analytics teams: Reviewed reference tables

Keep region mappings, targets or exchange rates in a repository where changes go through review, and have every workflow read the current version.

Open data: Publishing a dataset

Commit a cleaned dataset to a public repository on a schedule; users and websites read it from GitHub, and the history shows what changed each time.

Data engineering: Snapshots with history

Write a monthly snapshot of a summary table to its own branch or path, so earlier versions can be compared with GitHub's history and diff.

Websites: Data for a static site

Update the CSV a static site builds its charts or tables from, so the site rebuilds with the new figures.

Use cases describe typical scenarios and are illustrative; the sample data is invented.

Why do this in Omniscope

How it fits into an Omniscope workflow

Read: GitHub (targets.csv) → Join (with actual sales from a Database block) → Report

Write: Database → Aggregate → Validate data → GitHub (Write, commit message "Monthly summary")

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder). It holds the GitHub block, set to read octo-org/sales-data (an example name), and a File block with placeholder.csv, the 36 records the block outputs for the invented file.
  2. The question: what were the orders and revenue per region over the six months?
  3. Follow the File block into the rest of the workflow: totals per region and month.
  4. To use your own repository: enter its owner/repository and a file path in the GitHub block (and a token if it is private), run it, and connect its Data output where the File block was.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the placeholder data, the block, and a Validate data check on the output.

Language and libraries

Python. It uses requests (Apache License 2.0) and pandas (BSD 3-Clause).

pandas is part of Omniscope's Python environment. requests is listed in the block's dependencies, so Omniscope installs it with pip on first run if it is missing.

Tested

The block is covered by automated tests that run its script against a stand-in for Omniscope's Python API and a stand-in for GitHub's API (no live calls): reading a public file, a branch and a token, a pasted address, compressed and tab-separated files, text that isn't a table, a missing file, a refused token, bad options; writing, with every request a commit would send checked (the default branch, the tree with only the file replaced, the commit and its parent, the branch update), a named branch with a message, no input, no token, an unknown branch, a branch that moved on, empty input, and 200,000 records.

Reference

Options

NameTypeWhat it does
Access tokenPasswordA GitHub personal access token. Optional to read a public repository; needed to read a private one (Contents: read) and to write (Contents: read and write).
ModeChoiceRead a file into records, or write the input records to a file as a new commit.
zlib-compressed fileYes / noTick if the file is (or should be written) compressed with zlib. Leave unticked for an ordinary CSV file.
SeparatorTextThe character between fields: , (the default), ; or | for example; \t or tab for a tab.
Repository pathTextowner/repository, such as octo-org/sales-data; a pasted https://github.com/... address also works.
File pathTextThe file within the repository, such as data/sales.csv. Folders that don't exist are created when writing.
BranchTextOptional. The branch to read from or commit to, such as main; empty uses the repository's default branch.
Commit messageTextOptional, for writing. Empty gives "Update <file path> from Omniscope".

Outputs

OutputWhat it holds
DataRead: the file's records. Write: one record describing the commit (branch, commit id and address, records written)