Skip to main content

Superset Accessor for Pandas DataFrames 🚀

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

PyPI version

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

Notes

  • Ensure you have a database or datasource in Superset that supports CSV uploads.
  • Ensure API access is enabled.
  • 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_dataset 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_dataset("people")
print(url)

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

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

Configuration Parameters for configure Function

Parameter Type Default Description
base_url str URL of Superset instance. /api/v1 is automatically appended.
username str
password str
provider Literal["db", "ldap", "oauth", "oid", "remote_user"] Indicates the authentication provider type.
database_name str Name of the database/datasource in Superset where data will be uploaded.
schema str "public" Specifies the schema to upload data to (should exist on the database).

Parameters for as_dataset Method

Parameter Type Default Description
dataset_name str {username}_generated_dataset_{random_suffix} Name of the dataset in Superset.
replace bool True Replace the existing dataset based on the dataset_name (if it already exists).
verbose_return bool False Return detailed information in stead of only the url

Return Types for as_dataset Method

Return Type Description Example Response
Dict[str, Any] (if verbose_return=True) Dictionary with detailed information about the created/updated dataset. {"dataset_id": 123, "name": "animal_sounds", "url": "https://superset/explore/?datasource_type=table&datasource_id=123"}
str (if verbose_return=False) URL of the uploaded dataset for direct visualisation access`. "https://superset/explore/?datasource_type=table&datasource_id=123"

Metadata

Release files for dataframe-to-superset 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataframe-to-superset 0.1.6
File Size Uploaded
dataframe_to_superset-0.1.6.tar.gz 35.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dataframe-to-superset 0.1.6
File Interpreter ABI Platform
dataframe_to_superset-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / dataframe_to_superset-0.1.6.tar.gz

Download URL dataframe_to_superset-0.1.6.tar.gz
Size 35.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dd8930e1601ddb3d0a7181148d7431610624e6addcf58a404a1234475013072d
BLAKE2b-256 checksum
How to use checksums
5ea12b5a5cb773f2486761c42a7dbeec131b879b385d15babb7142e09c5d66b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.7

Release files / dataframe_to_superset-0.1.6-py3-none-any.whl

Download URL dataframe_to_superset-0.1.6-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
809020851ba8d665d7f68c2ba7024ad00c26982f71359bcac30bb9ed684d8743
BLAKE2b-256 checksum
How to use checksums
e999d614b3aa0c75bde618bd5405bf12c903dc2a8e1cd3d981d915223f16a5e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.7

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page