Skip to content

Commit

Permalink
fix: error in publish command (unexpected keyword)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacalata authored Jan 8, 2025
2 parents d1f6c09 + a65cb8d commit b0a367e
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tabcmd/commands/datasources_and_workbooks/publish_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,24 @@ 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
)
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
)
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))
Expand All @@ -76,9 +87,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,
)
Expand All @@ -92,7 +101,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)
Expand Down

0 comments on commit b0a367e

Please sign in to comment.