File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,8 @@ def column_names(self) -> List[str]:
85
85
86
86
raise RuntimeError ("No valid CSV or BigQuery datasource found." )
87
87
88
- @classmethod
89
- def _retrieve_gcs_source_columns (
90
- cls , project : str , gcs_csv_file_path : str
91
- ) -> List [str ]:
88
+ @staticmethod
89
+ def _retrieve_gcs_source_columns (project : str , gcs_csv_file_path : str ) -> List [str ]:
92
90
"""Retrieve the columns from a comma-delimited CSV file stored on Google Cloud Storage
93
91
94
92
Example Usage:
@@ -139,7 +137,7 @@ def _retrieve_gcs_source_columns(
139
137
header_line = line [:first_new_line_index ]
140
138
141
139
# Split to make it an iterable
142
- header_line = header_line .split ("\n " )
140
+ header_line = header_line .split ("\n " )[: 1 ]
143
141
144
142
csv_reader = csv .reader (header_line , delimiter = "," )
145
143
except :
@@ -149,8 +147,8 @@ def _retrieve_gcs_source_columns(
149
147
150
148
return next (csv_reader )
151
149
152
- @classmethod
153
- def _retrieve_bq_source_columns (cls , project : str , bq_table_uri : str ) -> List [str ]:
150
+ @staticmethod
151
+ def _retrieve_bq_source_columns (project : str , bq_table_uri : str ) -> List [str ]:
154
152
"""Retrieve the columns from a table on Google BigQuery
155
153
156
154
Example Usage:
Original file line number Diff line number Diff line change @@ -2918,11 +2918,23 @@ def _run(
2918
2918
training_task_definition = schema .training_job .definition .automl_tabular
2919
2919
2920
2920
if self ._column_transformations is None :
2921
- column_transformations = [
2922
- {"auto" : {"column_name" : column_name }}
2921
+ _LOGGER .info (
2922
+ "No column transformations provided, so now retrieving columns from dataset in order to set default column transformations."
2923
+ )
2924
+
2925
+ column_names = [
2926
+ column_name
2923
2927
for column_name in dataset .column_names
2924
2928
if column_name != target_column
2925
2929
]
2930
+ column_transformations = [
2931
+ {"auto" : {"column_name" : column_name }} for column_name in column_names
2932
+ ]
2933
+
2934
+ _LOGGER .info (
2935
+ "The column transformation of type 'auto' was set for the following columns: %s."
2936
+ % column_names
2937
+ )
2926
2938
else :
2927
2939
column_transformations = self ._column_transformations
2928
2940
You can’t perform that action at this time.
0 commit comments