0. In this scenario we assume the registry has been initialized and that an entry has been added (CLI).
# # We are assuming here that the label books-db is an entry in the registry dbreader = transport.get.reader(label='address-db') # No database credentials _df = dbreader.read(sql="SELECT * FROM books where postal_code like '946%' ") print (_df.head())
1. Alternatively it is possible to directly use the authentication file dubbed "auth-file".
#
# We are assuming here that the label books-db is an entry in the registry
dbreader = transport.get.reader(auth_file='/home/me/http-auth.json') # No database credentials
_df = dbreader.read(sql="SELECT * FROM books where postal_code like '946%' ")
print (_df.head())
In this scenario, we are using connectivity parameters in the code. We do NOT recommend this if the code will be used/shared.
#
# In this scenario we are loading an SQLite3+ database
url= "https://raw.githubusercontent.com/codeforamerica/ohana-api/master/data/sample-csv/addresses.csv"
_args = {"provider":"http","database"}
dbreader = transport.get.reader(**_args) # No database credentials
_df = dbreader.read(sql="SELECT * FROM books where postal_code like '946%' ")
print (_df.head())