Skip to content

Commit

Permalink
Fixed issues with incorrect input config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmkc committed Apr 29, 2021
1 parent af0b990 commit ea5ef12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions google/cloud/aiplatform/datasets/_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def __init__(
raise ValueError("One of gcs_source or bq_source must be set.")

if gcs_source:
dataset_metadata = {"input_config": {"gcs_source": {"uri": gcs_source}}}
dataset_metadata = {"inputConfig": {"gcsSource": {"uri": gcs_source}}}
elif bq_source:
dataset_metadata = {"input_config": {"bigquery_source": {"uri": bq_source}}}
dataset_metadata = {"inputConfig": {"bigquerySource": {"uri": bq_source}}}

self._dataset_metadata = dataset_metadata

Expand Down
8 changes: 4 additions & 4 deletions google/cloud/aiplatform/datasets/tabular_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class TabularDataset(datasets._Dataset):

@property
def column_names(self) -> List[str]:
input_config = self._gca_resource.metadata.get("input_config")
input_config = self._gca_resource.metadata.get("inputConfig")

if input_config is None:
raise RuntimeError("No input_config found for dataset")
raise RuntimeError("No inputConfig found for dataset")

gcs_source = input_config.get("gcs_source")
bq_source = input_config.get("bigquery_source")
gcs_source = input_config.get("gcsSource")
bq_source = input_config.get("bigquerySource")

if gcs_source:
gcs_source_uris = gcs_source.get("uri")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/aiplatform/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
# dataset_metadata
_TEST_NONTABULAR_DATASET_METADATA = None
_TEST_METADATA_TABULAR_GCS = {
"input_config": {"gcs_source": {"uri": [_TEST_SOURCE_URI_GCS]}}
"inputConfig": {"gcsSource": {"uri": [_TEST_SOURCE_URI_GCS]}}
}
_TEST_METADATA_TABULAR_BQ = {
"input_config": {"bigquery_source": {"uri": _TEST_SOURCE_URI_BQ}}
"inputConfig": {"bigquerySource": {"uri": _TEST_SOURCE_URI_BQ}}
}

# CMEK encryption
Expand Down

0 comments on commit ea5ef12

Please sign in to comment.