Ubuntu上的SQL Server驱动程序有效,但未指定驱动程序名称

时间:2018-10-22 15:14:13

标签: sql-server ubuntu odbc driver

我需要从ubuntu机器向SQL Server创建一个表。 我使用python和dataframes。 我在计算机上安装了SQL Server驱动程序,这是代码:

SQL_SERVER_CONNECTION = 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=***;DATABASE=analytics;UID=***;PWD=***;'
con = pyodbc.connect(SQL_SERVER_CONNECTION)
engine = create_engine("mssql+pyodbc://", poolclass=StaticPool, creator=lambda: con)
df = pd.DataFrame({'id': [10, 11], 'name': ['abc', 'def']})
df.to_sql(name='tmp_table_name',
          con=engine,
          schema='dbo',
          index=False,
          if_exists='replace')

但是我有这个错误

/home/jenkins/.local/lib/python3.6/site-packages/sqlalchemy/connectors/pyodbc.py:79: 
SAWarning: No driver name specified; 
this is expected by PyODBC when using DSN-less connections
"No driver name specified; "

0 个答案:

没有答案