SQL Query

Introduction IBM Cloud SQL Query is a cloud-native service that lets you use ANSI SQL to analyze rectangular data stored in IBM Cloud Object Storage. It is hosted on IBM Cloud and includes a publicly accessible REST API. The V2 API documentation intends to help you get going with the SQL Query API, and it offers resources on how to operationalize it. The SQL Query V2 REST interface is deprecated, therefore use the V3 API of Data Enginehttps://cloud.ibm.com/apidocs/sql-query/sql-query-v3, which is backward compatible. API endpoint https://api.sql-query.cloud.ibm.com/ Running an SQL query You can use the SQL Query service REST V2 API to run queries and retrieve information about their status. This is especially helpful when writing code that automatically queries data. SQL Query provides the following REST APIs: 1. POST request to submit a new SQL job 2. GET request to receive details about a specific SQL job 3. GET request to receive a list of submitted SQL jobs Before you can call any of the above REST APIs, create an IAMhttps://console.bluemix.net/docs/iam/index.htmliamoverview bearer token and have your SQL Query instance Cloud Resource Name CRN available. You find the CRN in the SQL Query instance dashboard that provides a copy button to get it into your clipboard. Creating an IAM bearer token The recommended method to retrieve an IAM token programmatically is to create an API key for your IBM Cloud identity and then use the IAM token API to exchange that key for a token. Each token is valid only for one hour, and after a token expires you have to create a new one if you want to continue using the API. You can create a token in IBM Cloud or by using the IBM Cloud command line interface CLI. To create a token in the IBM Cloud: 1. Log in to IBM Cloudhttps://console.bluemix.net and select Manage Security Platform API Keys. 2. Create an API key for your own personal identity, copy the key value, and save it in a secure place. After you leave the page, you will no longer be able to access this value. 3. With your API key, set up Postman or another REST API tool and run the command to the right. 4. Use the value of the accesstoken property for your SQL Query API calls. Set the accesstoken value as the authorization header parameter for requests to the Watson Data APIs. The format is Authorization: Bearer

MethodPathSummary
POST/sql_jobsRun an SQL job
GET/sql_jobsGet information about recent SQL jobs
GET/sql_jobs/{job_id}Get information about a specific SQL job
GET/tablesList catalog tables
GET/tables/{table_name}Get information about a specific catalog table