Ejemplo n.º 1
0
 def __init__(self):
     self.gclient = text_db.DatabaseClient(
         GOOGLE["user"],
         GOOGLE["password"],
     )
     self.gspreadsheet = self.gclient.GetDatabases(
         spreadsheet_key=GOOGLE["key"])[0]
Ejemplo n.º 2
0
def main():
    (config, args) = parse_args()

    # NOTE: setup connection to db & table
    client = spreadsheet_textdb.DatabaseClient(config.email, config.password)
    db = get_db(client, config.sheetname, config.create)
    table = get_table(db, config.table, config.columns, config.create)

    # NOTE: look up sheet column names for future reference
    if config.show or config.update:
        table.LookupFields()
        config.headers = table.fields

    # NOTE: process mutually exclusive options create, show, update, delete
    if config.create:
        # NOTE: all operations for create are processsed at this point.
        sys.exit(0)

    elif config.show:
        handle_show(table, config)
    
    elif config.update:
        handle_update(table, config)

    elif config.delete:
        # TODO: add delete
        log.error("TODO: implement --delete")
        sys.exit(1)

    sys.exit(0)
Ejemplo n.º 3
0
 def __init__(self, spreadsheet_key):
     # connect to google docs and get spreadsheet
     self.gclient = text_db.DatabaseClient(GOOGLE_LOGIN, GOOGLE_PASSWORD)
     self.gspreadsheet = \
         self.gclient.GetDatabases(spreadsheet_key=spreadsheet_key)[0]
Ejemplo n.º 4
0
 def __init__(self, email, password):
     self.client = text_db.DatabaseClient(email, password)