Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update OpenAPI definition /database/available #16672

Merged

Conversation

WingCode
Copy link
Contributor

@WingCode WingCode commented Sep 11, 2021

SUMMARY

Update OpenAPI definition for the latest API response for database available. In previous spec, it is list of object expected but from the API response it is dict that is the key "databases" followed by a list of objects. Example:

{
  "databases": [
    {
      "available_drivers": [
        "psycopg2"
      ],
      "default_driver": "psycopg2",
      "engine": "postgresql",
      "name": "PostgreSQL",
      "parameters": {
        "properties": {
          "database": {
            "description": "Database name",
            "type": "string"
          },
          "encryption": {
            "description": "Use an encrypted connection to the database",
            "type": "boolean"
          },
          "host": {
            "description": "Hostname or IP address",
            "type": "string"
          },
          "password": {
            "description": "Password",
            "nullable": true,
            "type": "string"
          },
          "port": {
            "description": "Database port",
            "format": "int32",
            "maximum": 65536,
            "minimum": 0,
            "type": "integer"
          },
          "query": {
            "additionalProperties": {},
            "description": "Additional parameters",
            "type": "object"
          },
          "username": {
            "description": "Username",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "database",
          "host",
          "port",
          "username"
        ],
        "type": "object"
      },
      "preferred": true,
      "sqlalchemy_uri_placeholder": "postgresql://user:password@host:port/dbname[?key=value&key=value...]"
    },
    {
      "available_drivers": [
        "rest"
      ],
      "engine": "presto",
      "name": "Presto",
      "preferred": true
    },
    {
      "available_drivers": [
        "mysqldb"
      ],
      "default_driver": "mysqldb",
      "engine": "mysql",
      "name": "MySQL",
      "parameters": {
        "properties": {
          "database": {
            "description": "Database name",
            "type": "string"
          },
          "encryption": {
            "description": "Use an encrypted connection to the database",
            "type": "boolean"
          },
          "host": {
            "description": "Hostname or IP address",
            "type": "string"
          },
          "password": {
            "description": "Password",
            "nullable": true,
            "type": "string"
          },
          "port": {
            "description": "Database port",
            "format": "int32",
            "maximum": 65536,
            "minimum": 0,
            "type": "integer"
          },
          "query": {
            "additionalProperties": {},
            "description": "Additional parameters",
            "type": "object"
          },
          "username": {
            "description": "Username",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "database",
          "host",
          "port",
          "username"
        ],
        "type": "object"
      },
      "preferred": true,
      "sqlalchemy_uri_placeholder": "mysql://user:password@host:port/dbname[?key=value&key=value...]"
    },
    {
      "available_drivers": [
        "pysqlite"
      ],
      "engine": "sqlite",
      "name": "SQLite",
      "preferred": true
    },
    {
      "available_drivers": [
        "rest"
      ],
      "engine": "druid",
      "name": "Apache Druid",
      "preferred": false
    },
    {
      "available_drivers": [
        "thrift"
      ],
      "engine": "hive",
      "name": "Apache Hive",
      "preferred": false
    },
    {
      "available_drivers": [
        "thrift"
      ],
      "engine": "hive",
      "name": "Apache Spark SQL",
      "preferred": false
    }
  ]
}

TESTING INSTRUCTIONS

Download the OpenAPI spec from http://localhost:8088/api/v1/_openapi
Generate client

java -jar openapi-generator-cli.jar generate -i ./openapi.json -g python -o ./superset_py/ --skip-validate-spec

Test code

import openapi_client
from openapi_client.api.dashboards_api import DashboardsApi
from openapi_client.api.database_api import DatabaseApi

configuration = openapi_client.Configuration(
    host= "http://localhost:8088/api/v1",
    username="admin",
    password="admin")
api_client = openapi_client.ApiClient(configuration)
database_api = DatabaseApi(api_client)
databases = database_api.database_available_get()
print(databases)

@suddjian suddjian changed the title Update OpenAPI definition /database/available chore: Update OpenAPI definition /database/available Sep 13, 2021
@villebro
Copy link
Member

LGTM, thanks for fixing!

@villebro villebro merged commit 93fa478 into apache:master Sep 23, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
Co-authored-by: WingCode <thewinger94@gmail.com>
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
Co-authored-by: WingCode <thewinger94@gmail.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants