charset parameter mssql_db module

Hello everyone,

If possible, how can I set the charset parameter to mssql_db module?

In python I can do something like that:

conn = pymssql.connect(server, user, password, db_name, charset=‘WINDOWS-1252’)

KR,
Rafael

I guess you could but the create table statement in a file and point target to
it with state: import.

I’m sorry I don’t know if I got your point, nevertheless let me break down my situation:

I already have DB structure where those a lot of tables were created with German UMLAUT öäüÜÖÄ.

From time to time I have to run some scripts to maintain these tables, I’d like to automate this script execution so I created the following task:

  • name: Run script
    mssql_db:
    name: “{{ DB_NAME }}”
    login_host: “{{ DB_HOST }}”
    login_user: “{{ DB_USER }}”
    login_password: “{{ DB_PASS }}”
    state: import
    target: “{{ SCRIPT_PATH }}”

The step before that is SVN Checkout, as you can see I’m running a script in the import state, how should I change my script, that’s the point that I could not understand.

Thanks in advance for your support.

KR,
Rafael

Every MySQL command that support charset like alter/create database you can add
charset=<> to it, check the MySQL documentation on how.

But if you do a "ansible-doc mysql_db" you'll see that it has an encoding option.

    - encoding
        Encoding mode to use, examples include `utf8' or `latin1_swedish_ci'
  [Default: (null)]

After looking at the source code, this option has been there since before 2014
but the online documentation doesn't show it and several other options.

But I’m using mSsql_db

:frowning:

That makes a huge difference, sorry I misread.