def test_postgresqlmanager_df_insert_conflict(): """ test_df_insert_conflict is to verify the send_sql method works functionally without a easydb. """ utils.check_integration_test() dbvars = utils.get_variables() database_manager = db.PostgreSQLManger() database_manager.set_connection_data(dbvars) table = "test_customers" database_manager.open_conn() data_frame = pd.DataFrame( { "id": [9000001, 800001, 2000001, 3000001], 'first_name': ['brian', 'john', 'mary', 'same'], 'last_name': ['brian', 'john', 'mary', 'same'], 'email': ['brian', 'john', 'mary', 'same'], 'latitude': [1.1, 2.2, 3.3, 4.4], 'longitude': [1.1, 2.2, 3.3, 4.4], 'block_id': [1, 2, 3, 4], 'state_fips': [1, 2, 3, 4], 'state_code': ['brian', 'john', 'mary', 'same'], 'block_pop': [1, 2, 3, 4] }, columns=[ "id", 'first_name', 'last_name', "email", "latitude", "longitude", "block_id", "state_fips", "state_code", "block_pop" ]) create_fake_table(database_manager) database_manager.df_insert(data_frame, table) database_manager.df_insert(data_frame, table, conflict_id="id") database_manager.send_sql("DROP TABLE test_customers;") database_manager.close_conn()
def test_postgresqlmanager_connect_disconnect(): """ test_connect_disconnect to verify the send_sql method works functionally without a easydb. """ utils.check_integration_test() dbvars = utils.get_variables() database_manager = db.PostgreSQLManger() database_manager.set_connection_data(dbvars) database_manager.open_conn() database_manager.close_conn()
def test_postgresqlmanager_send_sql(): """ test_send_sql is to verify the send_sql method works functionally without a easydb. """ utils.check_integration_test() dbvars = utils.get_variables() database_manager = db.PostgreSQLManger() database_manager.set_connection_data(dbvars) database_manager.open_conn() table = dbvars["table"] database_manager.send_sql(f"SELECT * FROM {table};") database_manager.close_conn()