Skip to main content

A Python package to upload pandas DataFrames to Superset for easy visualization.

Project description

Superset Accessor for Pandas DataFrames

Note: The code docs AI-generated so may not be perfect (or even right lol).

PyPI version GitHub

Upload your DataFrame to Superset as a datasource for rapid visualization.

Notes

  • Ensure you have a database or datasource in Superset that supports CSV uploads.
  • To maintain a clean and organized Superset environment:
    • Within Superset create a dedicated database or datasource (specified by the database_name parameter in the configure function) for this package.
    • Consistently use the same database or datasource name when uploading data, as the package overwrites existing data by default.
  • Call SupersetAccessor.configure at least once before using the as_datasource accessor.

Installation

Install the package via pip:

pip install dataframe-to-superset

Usage

import pandas as pd
from dataframe_to_superset import SupersetAccessor

SupersetAccessor.configure(
    base_url="https://superset",
    username="your_username",
    password="your_password",
    provider="your_auth_provider",  # e.g., "ldap" or "db"
    database_name="your_database_name",
    schema="your_schema_name",  # optional, defaults to "public"
)

data = {"name": ["Alice", "Bob"], "age": [25, 30]}
df = pd.DataFrame(data)

url = df.superset.as_datasource("people")
print(url)

# Another example
data = {"animal": ["Wolf", "Cat"], "Sound": ["Howl", "Meow"]}
df = pd.DataFrame(data)

url = df.superset.as_datasource("animal_sounds", verbose_return = True)
print(url)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataframe_to_superset-0.1.3.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataframe_to_superset-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file dataframe_to_superset-0.1.3.tar.gz.

File metadata

File hashes

Hashes for dataframe_to_superset-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e67d7022d8335f089fcccf6c29268b66a2686dda34778cb1f261d48ffd6eefb7
MD5 411cda239589c684b2daaebea09b1e0a
BLAKE2b-256 942244076c725abbd2233b67158334187192f2f2324af56dddf69229bb8dd8fe

See more details on using hashes here.

File details

Details for the file dataframe_to_superset-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for dataframe_to_superset-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 61f7608e9c743d79f35d832a9ccd773f71055912947aa2c86d77c968899040d2
MD5 049b202a1b965315308a4870c37d8dd6
BLAKE2b-256 6929d54563c7d6f0584c20e8f450614b2de50f33cc23d1b582f0da999e5eff17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page