mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-24 11:35:54 +08:00
259 lines
5.7 KiB
GraphQL
259 lines
5.7 KiB
GraphQL
####################################################
|
|
# SQL helpers
|
|
####################################################
|
|
|
|
type SQLDialectInfo {
|
|
name: String!
|
|
|
|
dataTypes: [ String ]!
|
|
functions: [ String ]!
|
|
reservedWords: [ String ]!
|
|
quoteStrings: [ [ String ] ]!
|
|
singleLineComments: [ String ]!
|
|
multiLineComments: [ [ String ] ]!
|
|
|
|
catalogSeparator: String
|
|
structSeparator: String
|
|
scriptDelimiter: String
|
|
|
|
supportsExplainExecutionPlan: Boolean!
|
|
|
|
}
|
|
|
|
type SQLCompletionProposal {
|
|
displayString: String!
|
|
type: String!
|
|
score: Int
|
|
|
|
replacementString: String!
|
|
replacementOffset: Int!
|
|
replacementLength: Int!
|
|
cursorPosition: Int
|
|
|
|
icon: String
|
|
nodePath: String
|
|
}
|
|
|
|
####################################################
|
|
# Data read / SQL execution
|
|
####################################################
|
|
|
|
# SQL context must be created for each SQL editor
|
|
type SQLContextInfo {
|
|
|
|
id: ID!
|
|
connectionId: ID!
|
|
defaultCatalog: String
|
|
defaultSchema: String
|
|
|
|
}
|
|
|
|
input SQLDataFilterConstraint {
|
|
attribute: String!
|
|
orderPosition: Int
|
|
orderAsc: Boolean
|
|
|
|
criteria: String
|
|
operator: String
|
|
value: Object
|
|
}
|
|
|
|
input SQLDataFilter {
|
|
# Row offset. We use Float because offset may be bigger than 32 bit.
|
|
offset: Float
|
|
limit: Int
|
|
|
|
constraints: [ SQLDataFilterConstraint ]
|
|
where: String
|
|
orderBy: String
|
|
}
|
|
|
|
type SQLResultColumn {
|
|
position: Int!
|
|
name: String
|
|
label: String
|
|
icon: String
|
|
entityName: String
|
|
|
|
dataKind: String
|
|
typeName: String
|
|
fullTypeName: String
|
|
# Column value max length. We use Float because it may be bigger than 32 bit.
|
|
maxLength: Float
|
|
scale: Int
|
|
precision: Int
|
|
|
|
required: Boolean!
|
|
|
|
readOnly: Boolean!
|
|
readOnlyStatus: String
|
|
|
|
# Operations supported for this attribute
|
|
supportedOperations: [DataTypeLogicalOperation!]!
|
|
}
|
|
|
|
type DatabaseDocument {
|
|
id: String
|
|
contentType: String
|
|
properties: Object
|
|
data: Object
|
|
}
|
|
|
|
type SQLResultSet {
|
|
id: ID!
|
|
columns: [ SQLResultColumn ]
|
|
rows: [ [ Object ] ]
|
|
# server always returns hasMoreData = false
|
|
hasMoreData: Boolean
|
|
}
|
|
|
|
type SQLQueryResults {
|
|
title: String
|
|
updateRowCount: Float
|
|
sourceQuery: String
|
|
|
|
# Actual data format of this result
|
|
dataFormat: ResultDataFormat
|
|
|
|
resultSet: SQLResultSet
|
|
}
|
|
|
|
type SQLExecuteInfo {
|
|
|
|
# Status message
|
|
statusMessage: String
|
|
# Execute time (ms)
|
|
duration: Int!
|
|
# Actual conditions applied to query
|
|
filterText: String
|
|
# Results
|
|
results: [ SQLQueryResults! ]!
|
|
}
|
|
|
|
input SQLResultRow {
|
|
data: [ Object ]!
|
|
updateValues: Object
|
|
}
|
|
|
|
type DataTypeLogicalOperation {
|
|
id: ID!
|
|
expression: String!
|
|
argumentCount: Int
|
|
}
|
|
|
|
####################################################
|
|
# SQL Executio plan
|
|
####################################################
|
|
|
|
type SQLExecutionPlan {
|
|
query: String!
|
|
nodes: [SQLExecutionPlanNode!]!
|
|
}
|
|
|
|
type SQLExecutionPlanNode {
|
|
id: ID!
|
|
parentId: ID
|
|
|
|
kind: String!
|
|
name: String
|
|
type: String!
|
|
condition: String
|
|
description: String
|
|
properties: [ObjectPropertyInfo!]!
|
|
}
|
|
|
|
####################################################
|
|
# Query and Mutation
|
|
####################################################
|
|
|
|
extend type Query {
|
|
|
|
sqlDialectInfo( connectionId: ID! ): SQLDialectInfo
|
|
|
|
# Lists SQL contexts for a connection (optional) or returns the particular context info
|
|
sqlListContexts( connectionId: ID, contextId: ID ): [ SQLContextInfo ]!
|
|
|
|
sqlCompletionProposals(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
query: String!,
|
|
position: Int!,
|
|
maxResults: Int,
|
|
simpleMode: Boolean
|
|
): [ SQLCompletionProposal ]
|
|
|
|
sqlSupportedOperations(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
resultsId: ID!,
|
|
attributeIndex: Int!
|
|
): [DataTypeLogicalOperation!]!
|
|
}
|
|
|
|
extend type Mutation {
|
|
sqlContextCreate( connectionId: ID!, defaultCatalog: String, defaultSchema: String ): SQLContextInfo!
|
|
|
|
sqlContextSetDefaults( connectionId: ID!, contextId: ID!, defaultCatalog: ID, defaultSchema: ID ): Boolean!
|
|
|
|
sqlContextDestroy( connectionId: ID!, contextId: ID! ): Boolean!
|
|
|
|
# Execute SQL and return results
|
|
asyncSqlExecuteQuery(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
sql: String!,
|
|
filter: SQLDataFilter,
|
|
dataFormat: ResultDataFormat # requested data format. May be ignored by server
|
|
): AsyncTaskInfo!
|
|
|
|
# Read data from table
|
|
asyncReadDataFromContainer(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
containerNodePath: ID!,
|
|
filter: SQLDataFilter,
|
|
dataFormat: ResultDataFormat
|
|
): AsyncTaskInfo!
|
|
|
|
# Close results (free resources)
|
|
sqlResultClose(connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!
|
|
|
|
# Update single cell value
|
|
updateResultsData(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
resultsId: ID!,
|
|
# Row cell values (to identify row)
|
|
updateRow: [ Object ]!,
|
|
# Values to update - Map<Int,Object>
|
|
updateValues: Object
|
|
): SQLExecuteInfo
|
|
|
|
# Update multiple cell values
|
|
updateResultsDataBatch(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
resultsId: ID!,
|
|
|
|
updatedRows: [ SQLResultRow! ],
|
|
deletedRows: [ SQLResultRow! ],
|
|
addedRows: [ SQLResultRow! ],
|
|
): SQLExecuteInfo
|
|
|
|
# Returns SQLExecuteInfo
|
|
asyncSqlExecuteResults(taskId: ID!): SQLExecuteInfo !
|
|
|
|
|
|
# Read data from table
|
|
asyncSqlExplainExecutionPlan(
|
|
connectionId: ID!,
|
|
contextId: ID!,
|
|
query: String!,
|
|
configuration: Object!
|
|
): AsyncTaskInfo!
|
|
|
|
# Returns SQLExecutionPlan
|
|
asyncSqlExplainExecutionPlanResult(taskId: ID!): SQLExecutionPlan !
|
|
|
|
}
|