yehoshuadimarsky / bcpandas

High-level wrapper around BCP for high performance data transfers between pandas and SQL Server. No knowledge of BCP required!!
MIT License
125 stars 43 forks source link

bcp.exe console keep popping up when executing bcp.to_sql #204

Open magicaly2 opened 1 month ago

magicaly2 commented 1 month ago

i wrote a program and compiled it into .exe using nuitka with --windows-console-mode=disable when i run the program, another console (from bcp.exe) keep popping up every time my code execute bcpandas.to_sql how do i hide/not show the bcp.exe console?

my code: bcpandas.to_sql(df, schema=schema, table_name=table_name, creds=creds, index=False, if_exists='append', print_output=False, encoding=encoding)

note: when i run my code in visual studio code, i dont see bcp.exe console

magicaly2 commented 1 month ago

after some research, it seems like we can use creationflags from subprocess when executing cmd. is there already a way to achieve something like this that i missed?

in run_cmd:

from subprocess import CREATE_NO_WINDOW proc = Popen( cmd, stdout=PIPE, stderr=STDOUT, encoding="utf-8", errors="utf-8", shell=with_shell, creationflags=CREATE_NO_WINDOW -- add this )