MicrosoftSqlSelect
Execute a Microsoft SQL SELECT statement
Added in version 1.0.0.
Friendly name:
MS-SQL SelectStep class:
base_steps_syncpack.steps.MicrosoftSqlSelect.MicrosoftSqlSelectStep version:
1.1.1Required parameters:
database,host,username,password,port
Parameters
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
no |
– |
The database Table Example: |
|
string |
yes |
– |
The database Example: |
|
string |
yes |
– |
The host of the database Example: |
|
string |
yes |
– |
The db username Example: |
|
string |
yes |
– |
The db password Example: |
|
string (long) |
no |
– |
A full SELECT statement. Overrides the ‘fields’ statement.. Example: |
|
array of strings |
no |
|
Which fields to select. Example: |
|
boolean |
no |
|
Whether to return the results as a dictionary |
|
number |
yes |
|
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->SerializableExternal 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_dicttrue (the default) — a list of dicts keyed by column name;as_dictfalse — 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_dictchanges the output shape. Turning it off breaks any downstream step or Jinja template that addresses columns by name.portdefaults to1433here, but to7706on 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.