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

[FEATURE REQUEST] Support for SQL Server database mirroring #416

Open
Wedge009 opened this issue Oct 22, 2024 · 1 comment
Open

[FEATURE REQUEST] Support for SQL Server database mirroring #416

Wedge009 opened this issue Oct 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Wedge009
Copy link

Wedge009 commented Oct 22, 2024

I'm guessing this may not be supported, given this package depends on pyodbc which (as far as I know) doesn't accommodate SQL Server's 'fail-over partner' connection parameter.

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it

pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The target database, '<database name>', is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other databases in the availability group, enable read access to one or more secondary availability replicas in the group.  For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online. (976)")

Describe the preferred solution
The ability to have Django automatically connect to the database mirror in the case the primary server is marked as 'unavailable'.

Describe alternatives you've considered
I attempted to use Django's multiple database handling via its database routers, but my router doesn't appear to be called no matter what I try.

I also experimented with python-tds connections and, assuming its 'fail-over partner' issue is resolved in the next release, it could be an option for connecting to SQL Server databases. It is the only Python package I'm aware of that claims to support database mirroring in SQL Server. However, its corresponding Django integration project, https://github.com/denisenkom/django-sqlserver, doesn't appear to be maintained any more.

Reference Documentations/Specifications
https://learn.microsoft.com/en-au/sql/database-engine/database-mirroring/connect-clients-to-a-database-mirroring-session-sql-server

@Wedge009 Wedge009 added the enhancement New feature or request label Oct 22, 2024
@Wedge009
Copy link
Author

I managed to get database routing working within Django as a work-around.

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

No branches or pull requests

1 participant