oute-services-db-connection-sdk
v0.0.7
Published
- Initialization
Downloads
184
Readme
This module expose helper functions
- Initialization
params = {
url: @server url
token: @access token
}
DbConnection = require("oute-services-db-connection-sdk")
db_connection_instance = new DbConnection(params)
Cache functions
Core functions
- Save deployment
body = {
"_id": "mandb1",
"name": "Postgres SQL",
"thumbnail": "https://ccc.oute.app/cdata/db_hub/postgres.svg",
"db_type": "postgres",
"parent_id": "q-GmTD5-K",
"workspace_id": "ZzBfJMpfQ",
"configs": [],
"state": "ACTIVE"
}
await db_connection_instance.save(body)
- get db hub list
query = {}
await db_connection_instance.dbHubList(query)
- delete by id
connection_id = "mandb1"
await db_connection_instance.deleteById(connection_id)
- get by parent id
query = {
parent_id: "q-GmTD5-K"
}
await db_connection_instance.getByParent(query)
- map to assets
body = {
"connection_ids": ["mandb1"],
"workspace_id": "ZzBfJMpfQ",
"asset_id" : "q-GmTD5-K"
}
await db_connection_instance.mapToAsset(body)
- Test connection
body: {
connection_id: "mandb1", //Send this to save the schema for the given connections
state: {},
db_config: {"db_type": "postgres","configs": []},
options: {logging: false}
}
await db_connection_instance.testConnection(body)
- get tables
query: {
connection_id: "mandb1"
}
await db_connection_instance.getTables(query)
- get table fields
query: {
connection_id: "mandb1",
table_id: "Wz6viqLBxkU"
}
await db_connection_instance.getTableFields(query)