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

mssql.tsql_query: add autocommit connection option #49334

Merged
merged 1 commit into from
Aug 27, 2018

Conversation

LukeCarrier
Copy link
Contributor

What does this PR do?

When making schema changes (e.g. ALTER DATABASE) we need to configure the connection such that the driver manages committing changes, e.g.:

mssql.database.create:
  mssql.db_create:
    - name: mydb

mssql.database.alter:
  mssql.tsql_query:
    - name: ALTER mydb COLLATE Latin1_General_CS_AS
    - autocommit: True

Without autocommit enabled we'll receive a pymssql.OperationalError like the following:

(226, 'ALTER DATABASE statement not allowed within multi-
statement transaction.DB-Lib error message 226, severity 16:\\nGeneral SQL Serve
r error: Check messages from the SQL Server\\n')

What issues does this PR fix or reference?

None

Tests written?

No -- develop doesn't seem to contain any tests for this module.

Commits signed with GPG?

No

When making schema changes (e.g. ALTER DATABASE) we need to configure
the connection such that the driver manages committing changes, e.g.:

    mssql.database.create:
      mssql.db_create:
        - name: mydb

    mssql.database.alter:
      mssql.tsql_query:
        - name: ALTER mydb COLLATE Latin1_General_CS_AS
        - autocommit: True
@cachedout cachedout merged commit 71f9219 into saltstack:develop Aug 27, 2018
@LukeCarrier
Copy link
Contributor Author

Cheers @cachedout!

alexey-zhukovin pushed a commit to alexey-zhukovin/salt that referenced this pull request May 12, 2020
@alexey-zhukovin alexey-zhukovin added the has master-port port to master has been created label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has master-port port to master has been created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants