Share via


Sql Script - Get Sql Scripts By Workspace

Lists sql scripts.

GET {endpoint}/sqlScripts?api-version=2020-12-01

URI Parameters

Name In Required Type Description
endpoint
path True

string (uri)

The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.

api-version
query True

string

The Synapse client API Version.

Responses

Name Type Description
200 OK

SqlScriptsListResponse

OK.

Other Status Codes

CloudError

An error response received from the Azure Synapse service.

Examples

SqlScripts_ListByWorkspace

Sample request

GET exampleWorkspace.dev.azuresynapse.net/sqlScripts?api-version=2020-12-01

Sample response

Date: Sat, 16 Jun 2018 00:37:43 GMT
X-Content-Type-Options: nosniff
x-ms-ratelimit-remaining-subscription-reads: 14990
x-ms-request-id: 92292250-c10f-4c47-8eb6-b886b361add7
x-ms-correlation-request-id: 92292250-c10f-4c47-8eb6-b886b361add7
{
  "value": [
    {
      "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleWorkspaceName/sqlscripts/exampleSqlScript",
      "name": "exampleSqlScript",
      "type": "Microsoft.Synapse/workspaces/sqlscripts",
      "properties": {
        "description": "Covers the data transformation and LDW scenarios in one brief e2e story",
        "content": {
          "query": "SELECT TOP 100 * FROM example_table_name;",
          "currentConnection": {
            "name": "master",
            "type": "SqlOnDemand"
          },
          "metadata": {
            "language": "sql"
          }
        },
        "type": "SqlQuery"
      },
      "etag": "1500504f-0000-0200-0000-5cbe090f0000"
    }
  ]
}

Definitions

Name Description
CloudError

The object that defines the structure of an Azure Synapse error response.

Folder

The folder that this SQL script is in. If not specified, this SQL script will appear at the root level.

SqlConnection

The connection used to execute the SQL script.

SqlConnectionType

The type of the connection.

SqlScript

SQL script.

SqlScriptContent

The content of the SQL script.

SqlScriptMetadata

The metadata of the SQL script.

SqlScriptResource

Sql Script resource type.

SqlScriptsListResponse

A list of sql scripts resources.

SqlScriptType

The type of the SQL script.

CloudError

The object that defines the structure of an Azure Synapse error response.

Name Type Description
error.code

string

Error code.

error.details

CloudError[]

Array with additional error details.

error.message

string

Error message.

error.target

string

Property name/path in request associated with error.

Folder

The folder that this SQL script is in. If not specified, this SQL script will appear at the root level.

Name Type Description
name

string

The name of the folder that this SQL script is in.

SqlConnection

The connection used to execute the SQL script.

Name Type Description
databaseName

string

The associated database name (supported by SQL pool v3)

name

string

The identifier of the connection.

poolName

string

The associated SQL pool name (supported by SQL pool v3)

type

SqlConnectionType

The type of the connection.

SqlConnectionType

The type of the connection.

Value Description
SqlOnDemand
SqlPool

SqlScript

SQL script.

Name Type Description
content

SqlScriptContent

The content of the SQL script.

description

string

The description of the SQL script.

folder

Folder

The folder that this SQL script is in. If not specified, this SQL script will appear at the root level.

type

SqlScriptType

The type of the SQL script.

SqlScriptContent

The content of the SQL script.

Name Type Description
currentConnection

SqlConnection

The connection used to execute the SQL script.

metadata

SqlScriptMetadata

The metadata of the SQL script.

query

string

SQL query to execute.

resultLimit

integer

Limit of results, '-1' for no limit.

SqlScriptMetadata

The metadata of the SQL script.

Name Type Description
language

string

The language of the SQL script.

SqlScriptResource

Sql Script resource type.

Name Type Description
etag

string

Resource Etag.

id

string

Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties

SqlScript

Properties of sql script.

type

string

The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.

SqlScriptsListResponse

A list of sql scripts resources.

Name Type Description
nextLink

string

The link to the next page of results, if any remaining results exist.

value

SqlScriptResource[]

List of sql scripts.

SqlScriptType

The type of the SQL script.

Value Description
SqlQuery