Django 2.0+和SQL Server界面问题 [英] Django 2.0+ and SQL Server interface question

查看:62
本文介绍了Django 2.0+和SQL Server界面问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么必须同时安装Pyodbc和django-pyodbc-azure才能与Django的最新SQL Server版本对接?django为什么不能开箱即用使用Pyodbc?我在让Sql Server与python 3.4.5,Django 2.1,pyodbc 4.0+和Django-Pyodbc-azure 2.0.8兼容方面遇到麻烦.尝试查询用inspectdb反映的某些模型时,总是出现分段错误.

Why is it necessary to have both Pyodbc and django-pyodbc-azure installed to interface with recent SQL Server versions with Django? Why can't django just use Pyodbc out of the box? I'm having trouble getting Sql Server to play nice with python 3.4.5, Django 2.1, pyodbc 4.0+, and Django-Pyodbc-azure 2.0.8. I keep getting a segmentation fault thrown when attempting to query certain models that I reflected with inspectdb.

我正在使用的linux版本是openSUSE 42.1我正在使用的Sql Server版本是2014.

The version of linux that I am using is openSUSE 42.1 The version of Sql Server that I'm using is 2014.

推荐答案

django-pyodbc-azure 是Django引擎,它将Django ORM方法转换为原始SQL(以及其他功能). pyodbc 允许Python通过 unixODBC 使用特定于数据库的驱动程序对数据库运行原始SQL查询.所有数据库后端均是如此.他们同时具有Django引擎和Python包.例如,在PostgreSQL中,它使用了随附的Django postgresql 引擎,该引擎可与 psycopg2 Python软件包一起使用.

django-pyodbc-azure is the Django engine which translates the Django ORM methods to raw SQL (among other functions). pyodbc allows Python to run raw SQL queries against the database, through unixODBC with a driver specific to the database. The same is true for all DB backends; they have both a Django engine and a Python package that work together. With PostgreSQL, for example, it uses the included Django postgresql engine, which works with the psycopg2 Python package.

在SQL Server的堆栈中, pyodbc 通过 unixODBC freetds msodbc Microsoft进行通信司机.翻译有几层.

Further down the stack for SQL Server, pyodbc communicates through unixODBC and either freetds or the msodbc Microsoft driver. There are several layers of translation.

从Web服务器到SQL Server的数据库服务器的堆栈:

The stack, from your web server to your database server for SQL Server:

  • django-pyodbc-azure :将Django的ORM方法转换为原始SQL.
  • pyodbc :从Python桥接到unixODBC
  • unixODBC 库,用于在* nix上进行ODBC通信.
  • freetds msodbc :从unixODBC到SQL Server的驱动程序桥.
  • django-pyodbc-azure: translates Django's ORM methods to raw SQL.
  • pyodbc: bridge to unixODBC from Python
  • unixODBC library for ODBC communication on *nix.
  • freetds or msodbc: driver bridge from unixODBC to SQL Server.

这篇关于Django 2.0+和SQL Server界面问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆