Skip to content

A custom SQLAlchemy dialect for integrating Kubling with Apache Superset

License

Notifications You must be signed in to change notification settings

kubling-community/kubling-sqlalchemy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubling SQLAlchemy Dialect

Kubling license PyPI Contributions Welcome

A custom SQLAlchemy dialect for integrating Kubling with Apache Superset. This dialect enables seamless querying and visualization of Kubling data within Superset by leveraging its PostgreSQL-compatible protocol.


🚀 Features

  • PostgreSQL-Compatible: Connects to Kubling using its PostgreSQL protocol.
  • Data Type Mapping: Automatically maps Kubling data types to SQLAlchemy types.
  • Seamless Integration: Fully supports Superset for visualizations and dashboards.
  • Open Source: Contributions and feedback are welcome to improve this dialect!

🛠️ Installation

Prerequisites

  • Python 3.7+
  • Apache Superset
  • Access to a Kubling instance

Install the Dialect

You can install the dialect using pip:

pip install kubling-sqlalchemy

Build

The build process for this project is divided into two pipelines:

  1. Main Pipeline:

    • Responsible for building the Kubling SQLAlchemy dialect.
    • Pushes the library to PyPI for distribution.
  2. Superset Pipeline:

    • Located in the superset/ directory.
    • Builds an OCI-compliant image based on the official Apache Superset image.
    • Installs the Kubling dialect into the Superset container, enabling seamless Kubling integration.

CI/CD and Docker Context

  • This project still utilizes Jenkins for continuous integration and delivery, including both pipelines.
  • Dockerized Build Process:
    • All build and packaging tasks occur within a Docker context.
    • This design ensures ease of forking and customization, allowing you to adapt the pipelines to your specific needs with minimal effort.

Configure Apache Superset

Using the Kubling Dialect

  1. Add the dialect library to your Superset installation:

    pip install kubling-sqlalchemy
  2. Restart Superset to apply the changes:

    superset run -p 8088
  3. Add a new database connection in Superset using the following connection string format:

    kubling://<username>:<password>@<host>:<port>/<vdb_name>
    

Using the Dockerized Version

Alternatively, you can use the pre-built Docker image that includes the Kubling dialect:

  1. Pull the Docker image:

    docker pull kubling/kubling-superset:latest
  2. Run the container:

    docker run -d --name kubling-superset \
        -p 8088:8088 \
        -e SUPERSET_SECRET_KEY=$(openssl rand -base64 42) \
        kubling/kubling-superset:latest
    • Replace $(openssl rand -base64 42) with a strong secret key or leave it as-is for dynamic generation.
  3. Access Superset:

  4. Add a new database connection in Superset:

    • Use the same connection string format as described above:
      kubling://<username>:<password>@<host>:<port>/<vdb_name>
      

📝 Example

Here’s an example of how to use the dialect programmatically with SQLAlchemy:

from sqlalchemy import create_engine

# Replace with your Kubling connection details
engine = create_engine("kubling://username:password@localhost:35432/vdb_name")

# Test a query
with engine.connect() as connection:
    result = connection.execute("SELECT * FROM SYS.SCHEMAS")
    for row in result:
        print(row)

🤝 Contributing

We welcome contributions to make this project better!

For major changes, please open an issue first to discuss what you would like to change.

About

A custom SQLAlchemy dialect for integrating Kubling with Apache Superset

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published