django-pyodbc

Prevent Django from updating identity column in MSSQL

怎甘沉沦 提交于 2020-01-24 06:45:10
问题 I'm working with a legacy DB in MSSQL. We have a table that has two columns that are causing me problems: class Emp(models.Model): empid = models.IntegerField(_("Unique ID"), unique=True, db_column=u'EMPID') ssn = models.CharField(_("Social security number"), max_length=10, primary_key=True, db_column=u'SSN') # Field name made lowercase. So the table has the ssn column as primary key and the relevant part of the SQL-update code generated by django is this: UPDATE [EMP] SET [EMPID] = 399, ....

By adding one statement import pyodbc causes Internal Server Error in Apache HTTP Server

女生的网名这么多〃 提交于 2019-12-31 04:27:12
问题 To run the normal school old python file in Apache Server. I had coded this way index.html <form action="/cgi-bin/hello_get.py" method="post"> First Name: <input type="text" name="first_name"> <br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="Submit" /> </form> hello_get.py #!C:/Users/Desktop/AppData/Local/Programs/Python/Python36-32/python # Import modules for CGI handling import cgi, cgitb import pyodbc # Create instance of FieldStorage form = cgi

Custom Django binary field & SQL Server 2008

允我心安 提交于 2019-12-24 20:33:02
问题 I have a little table: CREATE TABLE [organization_division] ( [id] int IDENTITY (1, 1) NOT NULL PRIMARY KEY, [uuid] binary(16) NOT NULL ) I can insert a record with SQL query: INSERT INTO [organization_division] ([uuid]) VALUES (0x244c71c6c9444f38b67ab1dcfbb5fc32) The Django model for this table is: from apps.lib.fields import GUIDField class Division(models.Model): uuid = GUIDField() GUIDField is my attempt to create a custom field: class GUIDField(models.Field): description = "GUID binary

pyodbc on SQL Server - How can I do an insert and get the row ID back?

柔情痞子 提交于 2019-12-21 13:08:00
问题 I'm using pyodbc with SQL Server 2000. I want to be able to insert a row and get the auto incremented row id value back? Any ideas? Here's what I have so far: cursor.execute("insert into products(id, name) values ('pyodbc', 'awesome library')") cnxn.commit() 回答1: Sorry, I asked too soon, it's addressed in their FAQ Use "SELECT @@IDENTITY". 来源: https://stackoverflow.com/questions/2883722/pyodbc-on-sql-server-how-can-i-do-an-insert-and-get-the-row-id-back

django-mssql on debian linux

ⅰ亾dé卋堺 提交于 2019-12-13 09:13:36
问题 Anyone has success on install django-mssql on linux machine? My deploy server is debian linux and I cant deploy my applications made on windows machine. I have troubes on my legacy latin1 database on acess it from pyodbc on django, Anyone has a solve to it? 回答1: Pywin32 is a requirement. I don't believe there is a way of getting that installed and working on debian linux. Django-mssql requirements 回答2: Actually,there is a workaround with ODBC interface. Install Microsoft ODBC Driver 1.0 for

Performance issue with django exclude

前提是你 提交于 2019-12-10 21:07:36
问题 I have a Django 1.8 application, and I am using an MsSQL database, with pyodbc as the db backend (using "django-pyodbc-azure" module). I have the following models: class Branch(models.Model): name = models.CharField(max_length=30) startTime = models.DateTimeField() class Device(models.Model): uid = models.CharField(max_length=100, primary_key=True) type = models.CharField(max_length=20) firstSeen = models.DateTimeField() lastSeen = models.DateTimeField() class Session(models.Model): device =

django-pyodbc vs django-mssql

 ̄綄美尐妖づ 提交于 2019-12-10 13:53:21
问题 It's in the title really. I want to run Django against MSSQL 2005. Both look reasonably active and up to date. I can't seem to see any unique points for either. Can anyone recommend one over the other? Would it be trivial to swap between the two at a later date? Are they production-ready? Thanks! 回答1: My choose is django-pyodbc because of cross-platform requirements. django-mssql runs only on Windows. Django-pyodbc works with South. Django-pyodbc has some bugs and pyodbc itself too. I've

Django-pydobc SQL server connection problems on windows

孤街醉人 提交于 2019-12-06 21:51:01
问题 Another developer and I are setting up a django (v1.4.2) project using a legacy SQL server database (SQLEXPRESS) on another server. So far, we have been able to connect to the database from linux and mac using django-pyodbc, and from a laptop running windows 7 using django-mssql. I would like to use django-pyodbc on the laptop to keep the environments in sync. On the laptop: pyodbc (3.0.6) is installed and in a non-django .py script I can connect and run sql statements Downloaded django

How can I connect to SQL Server 2008 R2 with django-mssql?

旧街凉风 提交于 2019-12-06 08:33:01
问题 I cannot figure out why I cannot get django to connect with sql server 2008 r2. I have administrative privileges on our server and on sql server. I have constructed a virtual windows box with windows server 2008 sp2 because I thought I might have some luck with django-mssql. I've tried both django-pyodbc and django-mssql on the windows box but have not yet succeeded. Here are my db settings: DATABASES = { 'default': { 'ENGINE': 'sqlserver_ado', # Have also tried sql_server.pyodbc 'NAME':

How can I connect to SQL Server 2008 R2 with django-mssql?

无人久伴 提交于 2019-12-04 15:36:09
I cannot figure out why I cannot get django to connect with sql server 2008 r2. I have administrative privileges on our server and on sql server. I have constructed a virtual windows box with windows server 2008 sp2 because I thought I might have some luck with django-mssql. I've tried both django-pyodbc and django-mssql on the windows box but have not yet succeeded. Here are my db settings: DATABASES = { 'default': { 'ENGINE': 'sqlserver_ado', # Have also tried sql_server.pyodbc 'NAME': 'TMSEPLAY', 'USER': '***', # Omitted for post 'PASSWORD': '*******', # Omitted for post 'HOST': '172.16.1