pandas read_csv pyodbc executemany

python > pandas read_csv pyodbc executemany
21.10.2019 12:43:34


Наиболее часто встречающиеся слова в статье:

[style="color] [font-weight] [class="python"] [style="font-family] [monospace] [font-style] ['REGIONS] [SubjectRoleType_UTL'] [read_csv] [/bufer/test]


Статья:

import pandas as pd 
import numpy as np
import pyodbc
#[''REGIONS;U_41;258;17.09.2019;31.12.9999;SubjectRoleType_UTL'']
data = pd.read_csv(''d:/bufer/test.csv'', sep = ";") 
conn = pyodbc.connect(''DRIVER={SQL Server};SERVER=skp-db2;DATABASE=MDM_Light;'')
cursor = conn.cursor()
df = np.array(data [[''Домен'', ''Логин'']])
z=[]
for c in df:
   z.append((c[0], c[1]))
 
cursor.executemany("insert into ARCH_BF_MDM_Light.dbo.zzz (id1,id2) values (?,?);", z)
conn.commit()
print(''Готово'')