microsoft / microsoft/mssql-django

how can we use varchar instead of nvarchar for models.CharField

Open
#175 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: data-types-dml enhancement
Dominant language
Python
Stars
400
Forks
149
Avg merge
3d 10h
Merged PRs (30d)
19

Description

we have table that uses varchar as datatype, we are trying to use it as foreign key to another table completely created by models.Model

However mssql-django uses nvarchar as data type for models.CharField, which throws an error of non matching data types.

Question :

How to configure mssql-django with MSSQL server to use datatype varchar for models.CharField, or even how to create custom model which will lead to creating varchar datatype for collumn.

thanks in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by tracing how models.CharField is mapped to SQL Server types and reproduce the foreign-key mismatch; done means a documented, tested way to use varchar for the field, or a clear statement that this is unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python, sql
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.