You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.7 KiB
Python

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()