Module Expr Str ImportFrom alias ImportFrom alias alias TryExcept body Import alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Num Str Str Str NameLoad FunctionDef arguments args defaults body Expr Str If NameLoad body Return NameLoad Return TupleLoad NameLoad Str decorator_list FunctionDef arguments args defaults kwarg body Assign NameStore Dict For NameStore TupleLoad Str Str Str Str Str Str body If CompareIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad orelse Assign SubscriptStore NameLoad Index NameLoad Call SubscriptLoad NameLoad Index Str BinOpAdd Str NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str TryExcept body Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Return SubscriptLoad Call NameLoad Call AttributeLoad Call NameLoad attr Dict Str Call AttributeLoad NameLoad attr Index Str handlers ExceptHandler type NameLoad name NameStore body Return TupleLoad TupleLoad Str TupleLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args defaults kwarg body Expr Str Return Call NameLoad Str NameLoad decorator_list FunctionDef arguments args defaults kwarg body Expr Str Return ListComp SubscriptLoad NameLoad Index Num comprehension NameStore Call NameLoad Str keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str Return CompareEq Call NameLoad Call NameLoad Call AttributeLoad Str attr NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str TryExcept body If BoolOpAnd Call NameLoad NameLoad CompareNotIn NameLoad ListLoad Str Str Str Str body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad orelse Return NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args defaults kwarg body Expr Str Return Call NameLoad keyword Str keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str Return CompareEq Call NameLoad Call NameLoad keyword Call AttributeLoad Str attr NameLoad keyword NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad kwarg body Expr Str TryExcept body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str TryExcept body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str TryExcept body Return CompareEq Call NameLoad Call NameLoad keyword Call AttributeLoad Str attr NameLoad NameLoad Num handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str If CompareNotIn Str NameLoad body Return NameLoad Return CompareEq Call NameLoad Call NameLoad keyword Call AttributeLoad Str attr NameLoad NameLoad Num decorator_list FunctionDef arguments args defaults kwarg body Expr Str Return ListComp SubscriptLoad NameLoad Index Num comprehension NameStore Call NameLoad Str keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad kwarg body Expr Str If CompareNotIn Str NameLoad body Return NameLoad If Call NameLoad NameLoad NameLoad body Return NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Return NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str If CompareNotIn Str NameLoad body Return NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Call AttributeLoad Str attr NameLoad decorator_list
N/A N/A 
Module to provide MS SQL Server compatibility to salt.

:depends:   - FreeTDS
            - pymssql Python module

:configuration: In order to connect to MS SQL Server, certain configuration is
    required in minion configs/pillars on the relevant minions. Some sample
    pillars might look like::

        mssql.server: 'localhost'
        mssql.port:   1433
        mssql.user:   'sysdba'
        mssql.password:   'Some preferable complex password'
        mssql.database: ''

    The default for the port is '1433' and for the database is '' (empty string);
    in most cases they can be left at the default setting.
    Options that are directly passed into functions will overwrite options from
    configs or pillars.
 __future__ absolute_import json JSONEncoder loads N/A N/A N/A pymssql N/A HAS_ALL_IMPORTS True N/A N/A N/A ImportError N/A N/A HAS_ALL_IMPORTS False N/A _DEFAULTS N/A server port user password database as_dict localhost 1433 sysdba False __virtual__ N/A N/A N/A N/A N/A 
    Only load this module if all imports succeeded bin exists
     N/A HAS_ALL_IMPORTS N/A N/A True N/A N/A False The mssql execution module cannot be loaded: the pymssql python library is not available. N/A _get_connection N/A N/A N/A kwargs N/A N/A connection_args N/A N/A arg N/A server port user password database as_dict N/A N/A N/A arg kwargs N/A N/A N/A connection_args N/A arg N/A kwargs N/A arg N/A N/A N/A connection_args N/A arg N/A N/A __salt__ N/A config.option N/A mssql. arg N/A N/A _DEFAULTS get arg None N/A N/A N/A pymssql connect connection_args N/A _MssqlEncoder N/A JSONEncoder N/A default N/A N/A self o N/A N/A N/A N/A str o N/A N/A tsql_query N/A N/A query N/A kwargs N/A N/A 
    Run a SQL query and return query result as list of tuples, or a list of dictionaries if as_dict was passed, or an empty list if no data is available.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.tsql_query 'SELECT @@version as version' as_dict=True
     N/A N/A N/A cur N/A N/A N/A _get_connection kwargs cursor N/A N/A N/A cur execute query N/A N/A N/A loads N/A N/A N/A _MssqlEncoder encode N/A resultset N/A N/A cur fetchall N/A resultset N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not run the query N/A N/A str e N/A version N/A N/A N/A kwargs N/A N/A 
    Return the version of a MS SQL server.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.version
     N/A N/A tsql_query SELECT @@version kwargs N/A db_list N/A N/A N/A kwargs N/A N/A 
    Return the databse list created on a MS SQL server.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.db_list
     N/A N/A N/A row N/A 0 N/A row N/A tsql_query SELECT name FROM sys.databases as_dict False kwargs N/A db_exists N/A N/A database_name N/A kwargs N/A N/A 
    Find if a specific database exists on the MS SQL server.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.db_exists database_name='DBNAME'
     N/A N/A N/A len N/A tsql_query N/A N/A SELECT database_id FROM sys.databases WHERE NAME='{0}' format database_name kwargs 1 N/A db_remove N/A N/A database_name N/A kwargs N/A N/A 
    Drops a specific database from the MS SQL server.
    It will not drop any of 'master', 'model', 'msdb' or 'tempdb'.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.db_remove database_name='DBNAME'
     N/A N/A N/A N/A N/A db_exists database_name N/A database_name N/A master model msdb tempdb N/A N/A conn N/A _get_connection kwargs N/A N/A N/A conn autocommit True N/A cur N/A N/A conn cursor N/A N/A N/A cur execute N/A N/A ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE format database_name N/A N/A N/A cur execute N/A N/A DROP DATABASE {0} format database_name N/A N/A N/A conn autocommit False N/A N/A N/A conn close N/A True N/A N/A False N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not find the database: {0} format e N/A role_list N/A N/A N/A kwargs N/A N/A 
    Lists database roles.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.role_list
     N/A N/A tsql_query query sp_helprole as_dict True kwargs N/A role_exists N/A N/A role N/A kwargs N/A N/A 
    Checks if a role exists.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.role_exists db_owner
     N/A N/A N/A len N/A tsql_query query N/A N/A sp_helprole "{0}" format role as_dict True kwargs 1 N/A role_create N/A N/A role owner N/A None kwargs N/A N/A 
    Creates a new database role.
    If no owner is specified, the role will be owned by the user that
    executes CREATE ROLE, which is the user argument or mssql.user option.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.role_create role=product01 owner=sysdba
     N/A N/A N/A conn N/A _get_connection kwargs N/A N/A N/A conn autocommit True N/A cur N/A N/A conn cursor N/A owner N/A N/A N/A N/A cur execute N/A N/A CREATE ROLE {0} AUTHORIZATION {1} format role owner N/A N/A N/A N/A cur execute N/A N/A CREATE ROLE {0} format role N/A N/A N/A conn autocommit True N/A N/A N/A conn close N/A True N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not create the role: {0} format e N/A role_remove N/A N/A role N/A kwargs N/A N/A 
    Remove a database role.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.role_create role=test_role01
     N/A N/A N/A conn N/A _get_connection kwargs N/A N/A N/A conn autocommit True N/A cur N/A N/A conn cursor N/A N/A N/A cur execute N/A N/A DROP ROLE {0} format role N/A N/A N/A conn autocommit True N/A N/A N/A conn close N/A True N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not create the role: {0} format e N/A login_exists N/A N/A login N/A kwargs N/A N/A 
    Find if a login exists in the MS SQL server.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.login_exists 'LOGIN'
     N/A N/A N/A N/A N/A len N/A tsql_query query N/A N/A SELECT name FROM sys.syslogins WHERE name='{0}' format login kwargs 1 N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not find the login: {0} format e N/A user_exists N/A N/A username N/A kwargs N/A N/A 
    Find if an user exists in a specific database on the MS SQL server.

    Note:
        *database* argument is mandatory

    CLI Example:

    .. code-block:: bash

        salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
     N/A N/A database kwargs N/A N/A False N/A N/A N/A len N/A tsql_query query N/A N/A SELECT name FROM sysusers WHERE name='{0}' format username kwargs 1 N/A user_list N/A N/A N/A kwargs N/A N/A 
    Get the user list for a specific database on the MS SQL server.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.user_list [database='DBNAME']
     N/A N/A N/A row N/A 0 N/A row N/A tsql_query SELECT name FROM sysusers where issqluser=1 or isntuser=1 as_dict False kwargs N/A user_create N/A N/A username new_login_password N/A None kwargs N/A N/A 
    Creates a new user.
    If new_login_password is not specified, the user will be created without a login.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.user_create USERNAME database=DBNAME [new_login_password=PASSWORD]
     N/A N/A database kwargs N/A N/A False N/A N/A user_exists username kwargs N/A N/A False N/A N/A N/A conn N/A _get_connection kwargs N/A N/A N/A conn autocommit True N/A cur N/A N/A conn cursor N/A new_login_password N/A N/A N/A login_exists username kwargs N/A N/A N/A N/A conn close N/A False N/A N/A N/A cur execute N/A N/A CREATE LOGIN {0} WITH PASSWORD='{1}',check_policy = off format username new_login_password N/A N/A N/A cur execute N/A N/A CREATE USER {0} FOR LOGIN {1} format username username N/A N/A N/A N/A cur execute N/A N/A CREATE USER {0} WITHOUT LOGIN format username N/A N/A N/A conn autocommit False N/A N/A N/A conn close N/A True N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not create the user: {0} format e N/A user_remove N/A N/A username N/A kwargs N/A N/A 
    Removes an user.

    CLI Example:

    .. code-block:: bash

        salt minion mssql.user_remove USERNAME database=DBNAME
     N/A N/A database kwargs N/A N/A False N/A N/A N/A conn N/A _get_connection kwargs N/A N/A N/A conn autocommit True N/A cur N/A N/A conn cursor N/A N/A N/A cur execute N/A N/A DROP USER {0} format username N/A N/A N/A conn autocommit False N/A N/A N/A conn close N/A True N/A N/A N/A Exception N/A e N/A N/A N/A N/A Could not create the user: {0} format e N/A