From 1908a38c429bedde99f9b0f26fa1e61f2afd6a3c Mon Sep 17 00:00:00 2001 From: Jac Fitzgerald Date: Mon, 6 Jan 2025 23:33:42 -0800 Subject: [PATCH 1/3] update publish workbook --- .../publish_command.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tabcmd/commands/datasources_and_workbooks/publish_command.py b/tabcmd/commands/datasources_and_workbooks/publish_command.py index a4ff8c26..cdf1ec8d 100644 --- a/tabcmd/commands/datasources_and_workbooks/publish_command.py +++ b/tabcmd/commands/datasources_and_workbooks/publish_command.py @@ -54,14 +54,23 @@ def run_command(args): publish_mode = PublishCommand.get_publish_mode(args, logger) + connection = TSC.models.ConnectionItem() if args.db_username: - creds = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password) + connection.connection_credentials = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password) + connections.append(connection) elif args.oauth_username: - creds = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth) + connection.connection_credentials = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth) + connections.append(connection) else: logger.debug("No db-username or oauth-username found in command") - creds = None + connection = None + if connection: + connections = list() + connections.append(connection) + else: + connections = None + source = PublishCommand.get_filename_extension_if_tableau_type(logger, args.filename) logger.info(_("publish.status").format(args.filename)) if source in ["twbx", "twb"]: @@ -76,9 +85,7 @@ def run_command(args): new_workbook, args.filename, publish_mode, - # args.thumbnail_username, not yet implemented in tsc - # args.thumbnail_group, - connection_credentials=creds, + connections=connections, as_job=False, skip_connection_check=args.skip_connection_check, ) @@ -92,7 +99,7 @@ def run_command(args): new_datasource.use_remote_query_agent = args.use_tableau_bridge try: new_datasource = server.datasources.publish( - new_datasource, args.filename, publish_mode, connection_credentials=creds + new_datasource, args.filename, publish_mode, connections=connections ) except Exception as exc: Errors.exit_with_error(logger, exception=exc) From 8aef27fb950e36f876a27f640381eb7ea5beb9ef Mon Sep 17 00:00:00 2001 From: Jac Fitzgerald Date: Mon, 6 Jan 2025 23:46:03 -0800 Subject: [PATCH 2/3] Update publish_command.py --- tabcmd/commands/datasources_and_workbooks/publish_command.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tabcmd/commands/datasources_and_workbooks/publish_command.py b/tabcmd/commands/datasources_and_workbooks/publish_command.py index cdf1ec8d..ab940e19 100644 --- a/tabcmd/commands/datasources_and_workbooks/publish_command.py +++ b/tabcmd/commands/datasources_and_workbooks/publish_command.py @@ -57,10 +57,8 @@ def run_command(args): connection = TSC.models.ConnectionItem() if args.db_username: connection.connection_credentials = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password) - connections.append(connection) elif args.oauth_username: connection.connection_credentials = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth) - connections.append(connection) else: logger.debug("No db-username or oauth-username found in command") connection = None From a65cb8d38dba334df2551450a9d2887d2bb5e841 Mon Sep 17 00:00:00 2001 From: Jac Fitzgerald Date: Mon, 6 Jan 2025 23:46:28 -0800 Subject: [PATCH 3/3] format --- .../datasources_and_workbooks/publish_command.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tabcmd/commands/datasources_and_workbooks/publish_command.py b/tabcmd/commands/datasources_and_workbooks/publish_command.py index ab940e19..98a3e5e9 100644 --- a/tabcmd/commands/datasources_and_workbooks/publish_command.py +++ b/tabcmd/commands/datasources_and_workbooks/publish_command.py @@ -56,9 +56,13 @@ def run_command(args): connection = TSC.models.ConnectionItem() if args.db_username: - connection.connection_credentials = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password) + connection.connection_credentials = TSC.models.ConnectionCredentials( + args.db_username, args.db_password, embed=args.save_db_password + ) elif args.oauth_username: - connection.connection_credentials = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth) + connection.connection_credentials = TSC.models.ConnectionCredentials( + args.oauth_username, None, embed=False, oauth=args.save_oauth + ) else: logger.debug("No db-username or oauth-username found in command") connection = None @@ -68,7 +72,7 @@ def run_command(args): connections.append(connection) else: connections = None - + source = PublishCommand.get_filename_extension_if_tableau_type(logger, args.filename) logger.info(_("publish.status").format(args.filename)) if source in ["twbx", "twb"]: