docs: def db_connect(engine, schema=None, clobber=False):
      """Create a connection object to a database. Attempt to establish a
      schema. If there are existing tables, delete them if clobber is
      True and return otherwise. Returns a sqlalchemy engine object.
  
      """
  
      if schema is None:
          base = declarative_base()
      else:
          try:
              engine.execute(sqlalchemy.schema.CreateSchema(schema))
          except sqlalchemy.exc.ProgrammingError as err:
              logging.warn(err)
          base = declarative_base(metadata=MetaData(schema=schema))
  
      define_schema(base)
  
      if clobber:
          logging.info('Clobbering database tables')
          base.metadata.drop_all(bind=engine)
  
      logging.info('Creating database tables')
      base.metadata.create_all(bind=engine)
  
      return base