Skip to content

Latest commit

 

History

History
142 lines (101 loc) · 2.36 KB

README.md

File metadata and controls

142 lines (101 loc) · 2.36 KB

bqls

BigQuery language server

Some Protocols

workspace/executeCommand

executeQuery

Execute a query and return the virtual text document url.

Request:

{
    "command": "executeQuery",
    "arguments": ["YOUR_DOCUMENT_URI"]
}

Response:

{
    "textDocument": {
        "uri": "bqls://project/${project}/job/${job}"
    }
}

You can get the result of the query by requesting the bqls/virtualTextDocument.

listDatasets

list up all datasets in the project.

Request:

{
    "command": "listDatasets",
    "arguments": ["YOUR_PROJECT_ID"]
}

Response:

{
    "datasets": ["dataset1", "dataset2", "dataset3"]
}

listTables

list up all tables in the dataset.

Request:

{
    "command": "listTables",
    "arguments": ["YOUR_PROJECT_ID", "YOUR_DATASET_ID"]
}

Response:

{
    "tables": ["table1", "table2", "table3"]
}

listJobHistories

list up job histories in the project.

Arguments:

  • --all-user: list up all jobs in the project. When this flag is not set, list up only jobs submitted by the user.

Request:

{
    "command": "listJobHistories",
}

Response:

{
    "jobs": [
        {
            "textDocument": { "uri": "bqls://..."},
            "id": "job_id",
            "owner": "[email protected]",
            "summary": "job summary"
        },
    ]
}

Custom API

bqls/virtualTextDocument

Requests a virtual text document from the LSP, which is a read only document that can be displayed in the client. bqls will encode all virtual files under custom schema bqls:, so clients should route all requests for the bqls: schema back to the bqls/virtualTextDocument. I used deno language server protocol below as reference.

For example, bqls can provide a virtual text document for a table information. Currently, bqls:// schema supported the following path:

  • table: bqls://project/${project}/dataset/${dataset}/table/${table}
  • job: bqls://project/${project}/job/${job}

Requests:

interface VirtualTextDocumentParams {
    textDocument: TextDocumentIdentifier;
}

Response:

interface VirtualTextDocument {
    contents: MarkedString[];
    result: QueryResult;
}

interface QueryResult {
    columns: string[];
    rows: any[][];
}