Collaborative development

0. In this scenario we assume the registry has been initialized and that an entry has been added (CLI).

# transport registry add --help
$ transport registry add address-db http-auth.json

The python code would look like the following :
import transport
#
#   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".

import transport
        #
        #   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())
        

Non-collaborative development

In this scenario, we are using connectivity parameters in the code. We do NOT recommend this if the code will be used/shared.

import transport
    #
    #   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())
    

Learn more
It is possible to initialize the registry; run ETL from your code as well as from the command line (CLI). We compiled this in notebooks available in our code repository