From 32676af393def951e777c88e9add31354fe0a14c Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Tue, 6 Oct 2026 18:51:26 -0500 Subject: [PATCH] demo code on marimo notebooks --- notebooks/__marimo__/session/notebook.py.json | 54 +++++++++++++ notebooks/notebook.py | 75 +++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 notebooks/__marimo__/session/notebook.py.json create mode 100644 notebooks/notebook.py diff --git a/notebooks/__marimo__/session/notebook.py.json b/notebooks/__marimo__/session/notebook.py.json new file mode 100644 index 0000000..9b7bb52 --- /dev/null +++ b/notebooks/__marimo__/session/notebook.py.json @@ -0,0 +1,54 @@ +{ + "version": "1", + "metadata": { + "marimo_version": "0.25.0", + "script_metadata_hash": null + }, + "cells": [ + { + "id": "Hbol", + "code_hash": "1dbd2873aa8a3fad8c9eb70075d10d56", + "outputs": [ + { + "type": "data", + "data": { + "text/html": "" + } + } + ], + "console": [] + }, + { + "id": "f9c5224a-f09a-44bb-a080-4c277c06a700", + "code_hash": "fe7c6ff68f623455a276988238123880", + "outputs": [ + { + "type": "data", + "data": { + "text/html": "" + } + } + ], + "console": [] + }, + { + "id": "d53090dd-0b48-49cc-ad07-8ed9f971f4cd", + "code_hash": "c46428317daf89a509ae68deffc5a6e3", + "outputs": [ + { + "type": "data", + "data": { + "text/plain": "" + } + } + ], + "console": [] + }, + { + "id": "7b91291b-179c-41ea-af6a-50e4c6a70b12", + "code_hash": null, + "outputs": [], + "console": [] + } + ] +} \ No newline at end of file diff --git a/notebooks/notebook.py b/notebooks/notebook.py new file mode 100644 index 0000000..d24b6ee --- /dev/null +++ b/notebooks/notebook.py @@ -0,0 +1,75 @@ +import marimo + +__generated_with = "0.24.2" +app = marimo.App() + + +@app.cell +def _(): + import transport + import marimo as mo + import io + # + # reading the synthetic data catalog + ddbr = transport.get.reader(label='ai-readi') + sql = "SELECT * FROM INFORMATION_SCHEMA.columns" + df = ddbr.read(sql=sql) + ddbr.close() + df # prints the database catalog + + + return df, io, transport + + +@app.cell +def _(transport): + # + # Let's see available features and technologies + transport.supported() + return + + +@app.cell +def _(io, transport): + # + # Let's retrieve data from github (over http|https) and write it to disk + # url = "https://raw.githubusercontent.com/codeforamerica/ohana-api/master/data/sample-csv/addresses.csv" + # dbr = transport.get.reader(provider="http",url=url) + # _data = dbr.read() + # dbr.close() + # + + + transport.registry.load() + file = io.StringIO(""" + { + "provider":"sqlite3", + "database":"/home/steve/dev/data/demo.db3" + } + """) + if not transport.registry.isloaded() or not transport.registry.exists() : + # + # The registry should be initialized + pass + # + # Creating a registry entry that will have the connectivity information that will be used using a label + # This can/should be done in CLI ... + # + transport.registry.set('github-data',file) + # transport.registry.isloaded() + # dbw = transport.get.writer(label='demo') + return + + +@app.cell +def _(df, transport): + # + # writing the addresses to an sqlite3+ database we reference by "demo" + dbw = transport.get.writer(label='github-data') + dbw.write(df,table='addresses') + dbw.close() + return + + +if __name__ == "__main__": + app.run()