def bcp(sql_item: str, direction: str, flat_file: str, creds, sql_type: str='table', schema: str='dbo', format_file_path: str=None, batch_size: int=None, col_delimiter: str=None, row_terminator: str=None, bcp_path: Union[(str, Path)]=None, error_file_path: str=None):
    '\n    See https://docs.microsoft.com/en-us/sql/tools/bcp-utility\n    '
    combos = {TABLE: [IN, OUT], QUERY: [QUERYOUT], VIEW: [IN, OUT]}
    direc = direction.lower()
    if (direc not in DIRECTIONS):
        raise BCPandasValueError(f"Param 'direction' must be one of {DIRECTIONS}, you passed {direc}")
    if (direc not in combos[sql_type]):
        raise BCPandasValueError(f'Wrong combo of direction and SQL object, you passed {sql_type} and {direc} .')
    if creds.with_krb_auth:
        auth = ['-T']
    else:
        auth = ['-U', creds.username, '-P', creds.password]
    if (sql_type == QUERY):
        sql_item_string = quote_this(''.join(sql_item.splitlines()))
    else:
        sql_item_string = f'{schema}.{sql_item}'
    bcp_command = ([('bcp' if (bcp_path is None) else quote_this(str(bcp_path))), sql_item_string, direc, flat_file, '-S', creds.server, '-d', creds.database, '-q', '-e', error_file_path] + auth)
    if batch_size:
        bcp_command += ['-b', str(batch_size)]
    if (direc == IN):
        bcp_command += ['-f', format_file_path]
    elif (direc in (OUT, QUERYOUT)):
        bcp_command += ['-c', quote_this(f"-t{(read_data_settings['delimiter'] if (col_delimiter is None) else col_delimiter)}"), quote_this(f"-r{(read_data_settings['newline'] if (row_terminator is None) else row_terminator)}")]
    bcp_command_log = [(c if (c != creds.password) else '[REDACTED]') for c in bcp_command]
    logger.info(f'''Executing BCP command now... 
BCP command is: {bcp_command_log}''')
    ret_code = run_cmd(bcp_command)
    if ret_code:
        raise BCPandasException(f'Bcp command failed with exit code {ret_code}')
See https://docs.microsoft.com/en-us/sql/tools/bcp-utility
def bcp(sql_item: str, direction: str, flat_file: str, creds, sql_type: str='table', schema: str='dbo', format_file_path: str=None, batch_size: int=None, col_delimiter: str=None, row_terminator: str=None, bcp_path: Union[(str, Path)]=None, error_file_path: str=None):
    '\n    \n    '
    combos = {TABLE: [IN, OUT], QUERY: [QUERYOUT], VIEW: [IN, OUT]}
    direc = direction.lower()
    if (direc not in DIRECTIONS):
        raise BCPandasValueError(f"Param 'direction' must be one of {DIRECTIONS}, you passed {direc}")
    if (direc not in combos[sql_type]):
        raise BCPandasValueError(f'Wrong combo of direction and SQL object, you passed {sql_type} and {direc} .')
    if creds.with_krb_auth:
        auth = ['-T']
    else:
        auth = ['-U', creds.username, '-P', creds.password]
    if (sql_type == QUERY):
        sql_item_string = quote_this(.join(sql_item.splitlines()))
    else:
        sql_item_string = f'{schema}.{sql_item}'
    bcp_command = ([('bcp' if (bcp_path is None) else quote_this(str(bcp_path))), sql_item_string, direc, flat_file, '-S', creds.server, '-d', creds.database, '-q', '-e', error_file_path] + auth)
    if batch_size:
        bcp_command += ['-b', str(batch_size)]
    if (direc == IN):
        bcp_command += ['-f', format_file_path]
    elif (direc in (OUT, QUERYOUT)):
        bcp_command += ['-c', quote_this(f"-t{(read_data_settings['delimiter'] if (col_delimiter is None) else col_delimiter)}"), quote_this(f"-r{(read_data_settings['newline'] if (row_terminator is None) else row_terminator)}")]
    bcp_command_log = [(c if (c != creds.password) else '[REDACTED]') for c in bcp_command]
    logger.info(f'Executing BCP command now... 
BCP command is: {bcp_command_log}')
    ret_code = run_cmd(bcp_command)
    if ret_code:
        raise BCPandasException(f'Bcp command failed with exit code {ret_code}')