示例#1
0
def test_update_df():
    """
    Intergration test to make sure there are no errors when running method.
    :param latitude:
    :param longitude:
    :param wanted:
    :return:
    """
    utils.check_integration_test()
    config = utils.get_variables()
    database_manager: database.DatabaseManager = database.DatabaseManager(
        config)
    database_manager.connect_db()
    database_manager.send_sql(sql.create_test_table())
    fake_data: dict = {
        'block_id': 5432,
        'state_fips': '1234',
        'state_code': 'Virginia',
        'block_pop': 50000,
        "id": 0
    }
    data_frame: pd.DataFrame = pd.DataFrame(fake_data, index=[0])
    database_manager.update_df(data_frame, "TestTable")
    database_manager.send_sql(sql.drop_table("TestTable"))
    database_manager.close_conn()
示例#2
0
def main():
    """
    This app is used for filling in missing data in the customers and stores tables.
    """
    config: utils.ConfigVars = utils.get_variables()
    log.setup_custom_logger()
    logging.info("Starting Table Update App")
    database_manager: database.DatabaseManager = database.DatabaseManager(
        config)
    utils.manage_update_stores(True, database_manager)
示例#3
0
def test_database_receive_sql_fetchall():
    """
    Intergration test to make sure there are no errors when running method.
    :param latitude:
    :param longitude:
    :param wanted:
    :return:
    """
    utils.check_integration_test()
    config = utils.get_variables()
    database_manager: database.DatabaseManager = database.DatabaseManager(
        config)
    database_manager.connect_db()
    database_manager.send_sql(sql.select_table("customers", 10))
    database_manager.close_conn()
示例#4
0
def test_df_to_sql():
    """
    Intergration test to make sure there are no errors when running method.
    :param latitude:
    :param longitude:
    :param wanted:
    :return:
    """
    utils.check_integration_test()
    config = utils.get_variables()
    database_manager: database.DatabaseManager = database.DatabaseManager(
        config)
    database_manager.connect_db()
    database_manager.send_sql(sql.create_test_table())
    fake_data: dict = {'first_name': 'testing', 'last_name': 'test_me'}
    data_frame: pd.DataFrame = pd.DataFrame(fake_data, index=[0])
    database_manager.df_to_sql(data_frame, "TestTable")
    database_manager.send_sql(sql.drop_table("TestTable"))
    database_manager.close_conn()