Skip to content

Commit bb6a079

Browse files
committed
PR feedback
[ch63042]
1 parent 9b655df commit bb6a079

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

python-runnables/export-to-stages/runnable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file is the actual code for the Python runnable export-to-stages
22
import logging
3+
import os
34
from dataiku import SQLExecutor2, Dataset, set_default_project_key
45
from dataiku.runnables import Runnable
56

@@ -61,7 +62,7 @@ def run(self, progress_callback):
6162
fully_qualified_stage_name = self.config.get('stage')
6263

6364
output_path = (self.config.get('path') or self.project_key).strip(' ').strip('/')
64-
destination = f"{output_path}/{dataset_name}" if output_path else dataset_name
65+
destination = os.path.join(output_path, dataset_name)
6566

6667
file_format_param = self.config.get('file_format') or 'default'
6768
file_format = '' if file_format_param == 'default' else f"FILE_FORMAT = (FORMAT_NAME = {file_format_param})"
@@ -75,8 +76,7 @@ def run(self, progress_callback):
7576
executor = SQLExecutor2(dataset=dataset_name)
7677
executor.query_to_df(sql_copy_query)
7778

78-
logging.info("Successfully exported dataset `%s.%s` in Snowflake stage `%s` to `%s`",
79-
self.project_key, dataset_name, fully_qualified_stage_name, destination)
79+
logging.info(f"Successfully exported dataset `{self.project_key}.{dataset_name}` in Snowflake stage `{fully_qualified_stage_name}` to `{destination}`")
8080

8181
return success('The dataset has been successfully exported in stage <strong>%s</strong> to <strong>%s_*</strong>'
8282
% (fully_qualified_stage_name.replace('"', ''), destination))

resource/compute_dynamic_params.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def macro_from_scenario_params(parameter_name):
3939
multiple_connections = len(datasets_per_connection) > 1
4040

4141
# indent only if we have multiple Snowflake connections
42-
indent = (lambda choice: {'value': choice['value'], 'label': f"  {choice['label']}"}) if multiple_connections else (lambda choice: choice)
42+
def do_indentation(choice):
43+
return {'value': choice['value'], 'label': f"  {choice['label']}"}
44+
indent = do_indentation if multiple_connections else (lambda choice: choice)
4345

4446
if parameter_name == 'dataset':
4547
choices = []
@@ -105,7 +107,7 @@ def macro_from_dataset_params(parameter_name, dataset_name):
105107
def get_snowflake_datasets():
106108
project_key = default_project_key()
107109
project = api_client().get_project(project_key)
108-
return filter(lambda dataset: dataset.type == 'Snowflake', project.list_datasets())
110+
return [dataset for dataset in project.list_datasets() if dataset.type == 'Snowflake']
109111

110112

111113
def is_dataset_valid(dataset_name):

0 commit comments

Comments
 (0)