def ingest(dbname, filename, dt, lt, cname, stname):
    db = dbio.connect(dbname)
    cur = db.cursor()
    schemaname, tablename = stname.split(".")
    cur.execute(
        "select * from information_schema.tables where table_schema='{0}' and table_name='{1}'".format(schemaname, tablename))
    if not bool(cur.rowcount):
        cur.execute("create table {0}.{1} (rid serial not null primary key, fdate date, tercile text, leadtime int, rast raster)".format(
            schemaname, tablename))
        db.commit()
    cur.execute("select * from {0} where fdate='{1}'".format(stname, dt.strftime("%Y-%m-%d")))
    if bool(cur.rowcount):
        cur.execute("delete from {0} where fdate='{1}'".format(stname, dt.strftime("%Y-%m-%d")))
        db.commit()
    dbio.ingest(dbname, filename, dt, stname, False, False)
    sql = "update {0} set tercile = '{1}' where tercile is null".format(
        stname, cname)
    cur.execute(sql)
    sql = "update {0} set leadtime = '{1}' where leadtime is null".format(
        stname, lt)
    cur.execute(sql)
    db.commit()
    cur.close()
Imports Geotif *filename* into database *db*.
dataset/ETHPy150Open nasa/RHEAS/src/datasets/iri.py/ingest