MicrosoftSqlSelect

Execute a Microsoft SQL SELECT statement

Added in version 1.0.0.

  • Friendly name: MS-SQL Select

  • Step class: base_steps_syncpack.steps.MicrosoftSqlSelect.MicrosoftSqlSelect

  • Step version: 1.1.1

  • Required parameters: database, host, username, password, port

Parameters

Name

Type

Required

Default

Description

table

string

no

–

The database Table Example: Users

database

string

yes

–

The database Example: database1

host

string

yes

–

The host of the database Example: host1

username

string

yes

–

The db username Example: ${db_user_name}

password

string

yes

–

The db password Example: ${db_password}

select_query

string (long)

no

–

A full SELECT statement. Overrides the ‘fields’ statement.. Example: SELECT COUNT(*) FROM XYZ

fields

array of strings

no

[]

Which fields to select. Example: ['field1', 'field2']

as_dict

boolean

no

True

Whether to return the results as a dictionary

port

number

yes

1433

The port number to use when establishing a connection to the remote sql server.

Every step also accepts the platform parameters common to all steps – see Platform parameters.

Dependencies

  • Inherits from: MicrosoftSqlSelect -> BaseStep -> Serializable

  • External packages: ipaascommon, ipaascore

Behaviour

Connects through the inherited BaseStep.connect_sql_server and runs a SELECT. Either table or select_query is required; select_query wins when both are set.

Outputs

A list of rows, or [] when nothing matches. The row type depends on as_dict:

  • as_dict true (the default) — a list of dicts keyed by column name;

  • as_dict false — a list of tuples, positional.

[
  {"ci_id": "abc123", "name": "web-01"},
  {"ci_id": "abc124", "name": "web-02"}
]

Example

{
  "host": "mssql.example.local",
  "port": 1433,
  "database": "ITSM",
  "username": "svc_pf",
  "password": "${config.db_password}",
  "select_query": "SELECT ci_id, name FROM cmdb_ci WHERE sys_updated_on > DATEADD(day, -1, GETDATE())",
  "as_dict": true
}

Notes

  • as_dict changes the output shape. Turning it off breaks any downstream step or Jinja template that addresses columns by name.

  • port defaults to 1433 here, but to 7706 on MicrosoftSqlInsert. Do not assume the default carries across steps in the same workflow.

  • No row limit is applied — page it in the SQL for large tables.