Skip to content

Commit

Permalink
change ttu log folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jburgueno authored Jul 20, 2021
1 parent 9b647ac commit 10f26b3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions airflow/providers/teradata/hooks/ttu.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_conn(self) -> dict:
login=connection.login,
password=connection.password,
host=connection.host,
ttu_log_folder=extras.get('ttu_log_folder', conf.get('logging', 'BASE_LOG_FOLDER')),
ttu_log_folder=extras.get('ttu_log_folder', '/tmp'),
console_output_encoding=extras.get('console_output_encoding', 'utf-8'),
bteq_session_encoding=extras.get('bteq_session_encoding', 'ASCII'),
bteq_output_width=extras.get('bteq_output_width', 65531),
Expand Down Expand Up @@ -336,7 +336,7 @@ def _prepare_tdload_command(input_file, host, login, password, encoding, table,
return tdload_command

@staticmethod
def _prepare_tpt_export_script(sql, output_file, encoding, delimiter, spool_mode, host, login, password, max_sessions, job_name= 'airflow_tptexport',block_size) -> str:
def _prepare_tpt_export_script(sql, output_file, encoding, delimiter, spool_mode, host, login, password, max_sessions, block_size,job_name= 'airflow_tptexport') -> str:
"""
Prepare a tpt script file with connection parameters for exporting data to CSV
:param sql : SQL sentence to export
Expand All @@ -351,6 +351,9 @@ def _prepare_tpt_export_script(sql, output_file, encoding, delimiter, spool_mode
:param block_size : specifies the block size to use when returning data to the client. The minimum is 256 bytes. The default is 1048472 bytes. The maximum is 16775168 bytes.
:param job_name : job name
"""
option_max_sessions = 'MaxSessions = {max_sessions},'.format(max_sessions=max_sessions)
if max_sessions == -1:
option_max_sessions = ''
return '''
USING CHARACTER SET {encoding}
DEFINE JOB {job_name}
Expand Down Expand Up @@ -379,13 +382,13 @@ def _prepare_tpt_export_script(sql, output_file, encoding, delimiter, spool_mode
UserPassword = '{password}',
SelectStmt = '{sql}',
TdpId = '{host}',
MaxSessions = {max_sessions},
{option_max_sessions}
SpoolMode = '{spool_mode}',
BlockSize = '{block_size}'
)
);
);
'''.format(filename=output_file, encoding=encoding, delimiter=delimiter, username=login,
password=password, sql=sql, host=host, max_sessions=max_sessions, job_name = job_name, spool_mode=spool_mode,block_size=block_size)
password=password, sql=sql, host=host, option_max_sessions=option_max_sessions, job_name = job_name, spool_mode=spool_mode,block_size=block_size)


0 comments on commit 10f26b3

Please sign in to comment.