def _load_data( connection_string: str, dialect: str, table_name: str = TAXI_DATA_TABLE_NAME, random_table_suffix: bool = True, ) -> LoadedTable: dialects_supporting_multiple_values_in_single_insert_clause: List[str] = [ "redshift" ] to_sql_method: str = ( "multi" if dialect in dialects_supporting_multiple_values_in_single_insert_clause else None) # Load the first 10 rows of each month of taxi data return load_data_into_test_database( table_name=table_name, csv_paths=[ f"./data/ten_trips_from_each_month/yellow_tripdata_sample_10_trips_from_each_month.csv" ], connection_string=connection_string, convert_colnames_to_datetime=["pickup_datetime", "dropoff_datetime"], load_full_dataset=True, random_table_suffix=random_table_suffix, to_sql_method=to_sql_method, )
UserConfigurableProfiler, ) context = ge.get_context() # </snippet> # This utility is not for general use. It is only to support testing. from tests.test_utils import load_data_into_test_database # The following load & config blocks up until the batch requests are only to support testing. MY_CONNECTION_STRING = "mysql+pymysql://root@localhost/test_ci" PG_CONNECTION_STRING = "postgresql+psycopg2://postgres:@localhost/test_ci" load_data_into_test_database( table_name="taxi_data", csv_path="./data/yellow_tripdata_sample_2019-01.csv", connection_string=MY_CONNECTION_STRING, ) load_data_into_test_database( table_name="taxi_data", csv_path="./data/yellow_tripdata_sample_2019-01.csv", connection_string=PG_CONNECTION_STRING, ) pg_datasource_config = { "name": "my_postgresql_datasource", "class_name": "Datasource", "execution_engine": { "class_name": "SqlAlchemyExecutionEngine", "connection_string": f"{PG_CONNECTION_STRING}",
import os from ruamel import yaml import great_expectations as ge CONNECTION_STRING = "postgresql+psycopg2://postgres:@localhost/test_ci" # This utility is not for general use. It is only to support testing. from tests.test_utils import load_data_into_test_database load_data_into_test_database( table_name="titanic", csv_path="./data/Titanic.csv", connection_string=CONNECTION_STRING, load_full_dataset=True, ) context = ge.get_context() # parse great_expectations.yml for comparison great_expectations_yaml_file_path = os.path.join( context.root_directory, "great_expectations.yml" ) with open(great_expectations_yaml_file_path) as f: great_expectations_yaml = yaml.safe_load(f) actual_datasource = great_expectations_yaml["datasources"] # expected Datasource expected_existing_datasource_yaml = r"""