Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports nullable unique constraints #69

Open
wants to merge 1 commit into
base: azure-1.9
Choose a base branch
from

Conversation

shlee322
Copy link

Supports nullable unique constraints (optional). Ref #43

Example

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'USER': 'user@myserver',             
        'PASSWORD': 'password',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',

        'OPTIONS': {
            'driver': 'ODBC Driver 11 for SQL Server',
            'supports_nullable_unique_constraints': True
        },
    },
}

@@ -201,7 +201,7 @@ def __init__(self, *args, **kwargs):
ops[op] = '%s COLLATE %s' % (sql, collation)
self.operators.update(ops)

self.features = DatabaseFeatures(self)
self.features = DatabaseFeatures(self, opts.get('supports_nullable_unique_constraints', False))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to just check connection.settings_dict['options'] within DatabaseFeatures.__init__? That way you don't need to change the signature around for every custom feature that's implemented.

Copy link
Author

@shlee322 shlee322 Jul 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevin-brown
i just wanted to overwirte BaseDatabaseFeatures.supports_nullable_unique_constraint

how would you think about :

self.features = DatabaseFeatures(self)
self.features.supports_nullable_unique_constraints = opts.get('supports_nullable_unique_constraints', False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants