예제 #1
0
                                  expectation_suite_name="test_suite")
print(validator.head())

# NOTE: The following code is only for testing and can be ignored by users.
assert isinstance(validator, ge.validator.validator.Validator)

# Here is a BatchRequest naming a data_asset
batch_request = BatchRequest(
    datasource_name="my_filesystem_datasource",
    data_connector_name="default_inferred_data_connector_name",
    data_asset_name="<YOUR_DATA_ASSET_NAME>",
)

# Please note this override is only to provide good UX for docs and tests.
# In normal usage you'd set your data asset name directly in the BatchRequest above.
batch_request.data_asset_name = "yellow_trip_data_sample_2018-01"

context.create_expectation_suite(expectation_suite_name="test_suite",
                                 overwrite_existing=True)
validator = context.get_validator(batch_request=batch_request,
                                  expectation_suite_name="test_suite")
print(validator.head())

# NOTE: The following code is only for testing and can be ignored by users.
assert isinstance(validator, ge.validator.validator.Validator)
assert [ds["name"]
        for ds in context.list_datasources()] == ["my_filesystem_datasource"]
assert ("yellow_trip_data_sample_2018-01"
        in context.get_available_data_asset_names()["my_filesystem_datasource"]
        ["default_inferred_data_connector_name"])
예제 #2
0
# Here is a BatchRequest naming a data_asset
batch_request = BatchRequest(
    datasource_name="my_gcs_datasource",
    data_connector_name="default_inferred_data_connector_name",
    data_asset_name="<YOUR_DATA_ASSET_NAME>",
    batch_spec_passthrough={
        "reader_method": "csv",
        "reader_options": {
            "header": True
        }
    },
)

# Please note this override is only to provide good UX for docs and tests.
# In normal usage you'd set your data asset name directly in the BatchRequest above.
batch_request.data_asset_name = (
    "data/taxi_yellow_tripdata_samples/yellow_tripdata_sample_2019-01")

context.create_expectation_suite(expectation_suite_name="test_suite",
                                 overwrite_existing=True)
validator = context.get_validator(batch_request=batch_request,
                                  expectation_suite_name="test_suite")
print(validator.head())

# NOTE: The following code is only for testing and can be ignored by users.
assert isinstance(validator, ge.validator.validator.Validator)
assert [ds["name"]
        for ds in context.list_datasources()] == ["my_gcs_datasource"]
assert set(
    context.get_available_data_asset_names()["my_gcs_datasource"]
    ["default_inferred_data_connector_name"]) == {
        "data/taxi_yellow_tripdata_samples/yellow_tripdata_sample_2019-01",
예제 #3
0
validator = context.get_validator(batch_request=batch_request,
                                  expectation_suite_name="test_suite")
print(validator.head())

# NOTE: The following code is only for testing and can be ignored by users.
assert isinstance(validator, ge.validator.validator.Validator)

# Here is a BatchRequest naming a data_asset
batch_request = BatchRequest(
    datasource_name="taxi_datasource",
    data_connector_name="default_inferred_data_connector_name",
    data_asset_name="<YOUR_DATA_ASSET_NAME>",
)

# Please note this override is only to provide good UX for docs and tests.
# In normal usage you'd set your data asset name directly in the BatchRequest above.
batch_request.data_asset_name = "yellow_tripdata_sample_2019-01.csv"

context.create_expectation_suite(expectation_suite_name="test_suite",
                                 overwrite_existing=True)
validator = context.get_validator(batch_request=batch_request,
                                  expectation_suite_name="test_suite")
print(validator.head())

# NOTE: The following code is only for testing and can be ignored by users.
assert isinstance(validator, ge.validator.validator.Validator)
assert [ds["name"] for ds in context.list_datasources()] == ["taxi_datasource"]
assert "yellow_tripdata_sample_2019-01.csv" in set(
    context.get_available_data_asset_names()["taxi_datasource"]
    ["default_inferred_data_connector_name"])