titan550/bcpy

Table Delimiters Required

Opened this issue · 1 comments

Love this library big time.

I installed bcp utils on a new machine recently and was having issues getting it to run. Further investigation revealed this error was being thrown with the raw command in a command prompt.

"A valid table name is required for in, out, or format options."

This did NOT work:
bcp database-123.dbo.table IN "C:\\Users\\my_user\\Desktop\\data\\my_csv.csv" -f C:\\Users\\my_user\\AppData\\Local\\Temp\\t9Lvdf2f32s7nw4I -S sql_server_address -b 10000 -U username -P password -F 2

This did work:
bcp [database-123].[dbo].[table] IN "C:\\Users\\my_user\\Desktop\\data\\my_csv.csv" -f C:\\Users\\my_user\\AppData\\Local\\Temp\\t9Lvdf2f32s7nw4I -S sql_server_address -b 10000 -U username -P password -F 2

This was fixed by adding brackets to binary_callers.py for the full_table_string. I believe this was due to the database having hyphens in the name - I don't see any harm in making this change, as it doesn't impact non special character identifiers.

image

Same problem, although I have no hyphens, blanks or any other special characters in my database name. Only chars and numbers.