Skip to content

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
        },
    },
}

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