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.4.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.4-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for dataframe_to_superset-0.1.4.tar.gz
Algorithm Hash digest
SHA256 48e514561ac38e84340189d457e18ede7a91165254d9f359e6db000979cff4fa
MD5 7aeef03033b734826b38dab6ab3b1b2d
BLAKE2b-256 30a5fec19e870acece26ef5a15d3a1f5824548d1802def031c9cae43b45f1b10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dataframe_to_superset-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 084ef7026d37e4a8c0f356785cfdf8096862269e71112d002992187456d829a5
MD5 9fd418933eb158d465a2dadfac1b33d8
BLAKE2b-256 6b4e1e2a209b80e6f7e02f9fc9a3ef2ec057ad09235922f5a8e0a91fce990692

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