Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use trustservercertificate=yes bcp #29

Open
raulcsouza opened this issue Oct 20, 2023 · 0 comments
Open

Can't use trustservercertificate=yes bcp #29

raulcsouza opened this issue Oct 20, 2023 · 0 comments

Comments

@raulcsouza
Copy link

Was not possible to set the parameter -u that permit Trust server certificate. (available since bcp version 18).

https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/connecting-with-bcp?view=sql-server-ver16

I did the modification below and works:

def bcp(sql_table, flat_file, batch_size):
"""Runs the bcp command to transfer the input flat file to the input
SQL Server table.
:param sql_table: The destination Sql Server table
:type sql_table: SqlTable
:param flat_file: Source flat file
:type flat_file: FlatFile
:param batch_size: Batch size (chunk size) to send to SQL Server
:type batch_size: int
"""
if sql_table.with_krb_auth:
auth = ['-T']
else:
auth = ['-U', sql_table.username , '-P', sql_table.password ]
full_table_string =
f'{sql_table.database}.{sql_table.schema}.{sql_table.table}'
try:
bcp_command = ['bcp', full_table_string, 'IN', flat_file.path, '-f',
flat_file.get_format_file_path(), '-S',
sql_table.server, '-b', str(batch_size), '-u'] + auth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant