Framework for Python

Publishing

publish_data()

Upload a DataFrame (as CSV, Parquet, or JSON) or a data file.

With compress, the file is gzipped and .gz is added to dest.

Usage

publish_data(
    data: pd.DataFrame | str | Path,
    dest: str,
    format: str = 'csv',
    connection: str | None = None,
    compress: bool = False,
    include_private: bool = False,
    *,
    allow_private: bool | None = None,
) -> str

Arguments

Name Type Default Description
data required pd.DataFrame | str | Path

A DataFrame to write in format, or the path of a file to upload as is.

dest required str

The object's path in the bucket, including any extension.

format str 'csv'

How a DataFrame is written. One of "csv", "parquet", or "json" (records). Default: "csv". It is checked for files too, but does not change them.

connection str | None None

A storage bucket name from the settings. Default: the project's default bucket, then one marked default: true, then the first.

compress bool False

Gzip the file before uploading.

include_private bool False

Upload files with "private" in their path without asking. Only a person who has reviewed the files should set this.

allow_private bool | None None

Deprecated name for include_private.

Value

The public URL.

Raises

  • FrameworkError: When format is not allowed, the file is missing or has "private" in its path and is not confirmed, no bucket is configured, or the upload fails.