Skip to content

Files

albert.resources.files

FileNamespace

Bases: str, Enum

The storage namespace a file lives in.

Attributes:

Name Type Description
AGENT

Files used by Albert agents.

BREAKTHROUGH

Files associated with Breakthrough (data science / modeling).

PIPELINE

Files used by data pipelines.

PUBLIC

Publicly accessible files.

RESULT

Files produced as results and attached to entities (the common default).

SDS

Safety Data Sheet files.

AGENT

AGENT = 'agent'

Files used by Albert agents.

BREAKTHROUGH

BREAKTHROUGH = 'breakthrough'

Files associated with Breakthrough (data science / modeling).

PIPELINE

PIPELINE = 'pipeline'

Files used by data pipelines.

PUBLIC

PUBLIC = 'public'

Publicly accessible files.

RESULT

RESULT = 'result'

Files produced as results and attached to entities (the common default).

SDS

SDS = 'sds'

Safety Data Sheet files.

FileCategory

Bases: str, Enum

The kind of file being stored.

Attributes:

Name Type Description
SDS

A Safety Data Sheet document.

OTHER

A general-purpose file with no specialized handling.

SDS

SDS = 'SDS'

A Safety Data Sheet document.

OTHER

OTHER = 'Other'

A general-purpose file with no specialized handling.

SignURLPOSTFile

Bases: BaseAlbertModel

Request entry describing a single file to be signed for upload.

Used internally to build the payload for get_signed_upload_url.

Show JSON schema:
{
  "$defs": {
    "FileCategory": {
      "description": "The kind of file being stored.",
      "enum": [
        "SDS",
        "Other"
      ],
      "title": "FileCategory",
      "type": "string"
    },
    "FileNamespace": {
      "description": "The storage namespace a file lives in.",
      "enum": [
        "agent",
        "breakthrough",
        "pipeline",
        "public",
        "result",
        "sds"
      ],
      "title": "FileNamespace",
      "type": "string"
    }
  },
  "description": "Request entry describing a single file to be signed for upload.\n\nUsed internally to build the payload for\n[`get_signed_upload_url`][albert.collections.files.FileCollection.get_signed_upload_url].",
  "properties": {
    "name": {
      "description": "The name (storage key) to store the file under.",
      "title": "Name",
      "type": "string"
    },
    "namespace": {
      "$ref": "#/$defs/FileNamespace",
      "description": "The namespace to store the file in."
    },
    "contentType": {
      "description": "The MIME type of the file.",
      "title": "Contenttype",
      "type": "string"
    },
    "metadata": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional key/value metadata to store with the file.",
      "title": "Metadata"
    },
    "category": {
      "anyOf": [
        {
          "$ref": "#/$defs/FileCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The category of the file (e.g. SDS, Other)."
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The signed URL returned by the API for this file.",
      "title": "Url"
    }
  },
  "required": [
    "name",
    "namespace",
    "contentType"
  ],
  "title": "SignURLPOSTFile",
  "type": "object"
}

Fields:

name

name: str

The name (storage key) to store the file under.

namespace

namespace: FileNamespace

The namespace to store the file in.

content_type

content_type: str

The MIME type of the file.

metadata

metadata: list[dict[str, str]] | None = None

Optional key/value metadata to store with the file.

category

category: FileCategory | None = None

The category of the file (e.g. SDS, Other).

url

url: str | None = None

The signed URL returned by the API for this file.

SignURLPOST

Bases: BaseAlbertModel

Request body wrapping the list of files to sign for upload.

Show JSON schema:
{
  "$defs": {
    "FileCategory": {
      "description": "The kind of file being stored.",
      "enum": [
        "SDS",
        "Other"
      ],
      "title": "FileCategory",
      "type": "string"
    },
    "FileNamespace": {
      "description": "The storage namespace a file lives in.",
      "enum": [
        "agent",
        "breakthrough",
        "pipeline",
        "public",
        "result",
        "sds"
      ],
      "title": "FileNamespace",
      "type": "string"
    },
    "SignURLPOSTFile": {
      "description": "Request entry describing a single file to be signed for upload.\n\nUsed internally to build the payload for\n[`get_signed_upload_url`][albert.collections.files.FileCollection.get_signed_upload_url].",
      "properties": {
        "name": {
          "description": "The name (storage key) to store the file under.",
          "title": "Name",
          "type": "string"
        },
        "namespace": {
          "$ref": "#/$defs/FileNamespace",
          "description": "The namespace to store the file in."
        },
        "contentType": {
          "description": "The MIME type of the file.",
          "title": "Contenttype",
          "type": "string"
        },
        "metadata": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional key/value metadata to store with the file.",
          "title": "Metadata"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/FileCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The category of the file (e.g. SDS, Other)."
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The signed URL returned by the API for this file.",
          "title": "Url"
        }
      },
      "required": [
        "name",
        "namespace",
        "contentType"
      ],
      "title": "SignURLPOSTFile",
      "type": "object"
    }
  },
  "description": "Request body wrapping the list of files to sign for upload.",
  "properties": {
    "files": {
      "description": "The files to request signed upload URLs for.",
      "items": {
        "$ref": "#/$defs/SignURLPOSTFile"
      },
      "title": "Files",
      "type": "array"
    }
  },
  "required": [
    "files"
  ],
  "title": "SignURLPOST",
  "type": "object"
}

Fields:

files

The files to request signed upload URLs for.

FileInfo

Bases: BaseAlbertModel

Metadata about a stored file in Albert.

Returned by get_by_name. Its name can be used as the key of an Attachment.

Show JSON schema:
{
  "$defs": {
    "FileNamespace": {
      "description": "The storage namespace a file lives in.",
      "enum": [
        "agent",
        "breakthrough",
        "pipeline",
        "public",
        "result",
        "sds"
      ],
      "title": "FileNamespace",
      "type": "string"
    }
  },
  "description": "Metadata about a stored file in Albert.\n\nReturned by\n[`get_by_name`][albert.collections.files.FileCollection.get_by_name]. Its ``name``\ncan be used as the ``key`` of an\n[`Attachment`][albert.resources.attachments.Attachment].",
  "properties": {
    "name": {
      "description": "The name (storage key) of the file.",
      "title": "Name",
      "type": "string"
    },
    "size": {
      "description": "The size of the file in bytes.",
      "title": "Size",
      "type": "integer"
    },
    "etag": {
      "description": "The storage entity tag (checksum) for the file.",
      "title": "Etag",
      "type": "string"
    },
    "namespace": {
      "anyOf": [
        {
          "$ref": "#/$defs/FileNamespace"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The namespace the file is stored in.",
      "title": "Namespace"
    },
    "contentType": {
      "description": "The MIME type of the file.",
      "title": "Contenttype",
      "type": "string"
    },
    "lastModified": {
      "description": "When the file was last modified.",
      "format": "date-time",
      "title": "Lastmodified",
      "type": "string"
    },
    "metadata": {
      "description": "Key/value metadata stored with the file.",
      "items": {
        "additionalProperties": {
          "type": "string"
        },
        "type": "object"
      },
      "title": "Metadata",
      "type": "array"
    }
  },
  "required": [
    "name",
    "size",
    "etag",
    "contentType",
    "lastModified"
  ],
  "title": "FileInfo",
  "type": "object"
}

Fields:

name

name: str

The name (storage key) of the file.

size

size: int

The size of the file in bytes.

etag

etag: str

The storage entity tag (checksum) for the file.

namespace

namespace: FileNamespace | str | None = None

The namespace the file is stored in.

content_type

content_type: str

The MIME type of the file.

last_modified

last_modified: datetime

When the file was last modified.

metadata

metadata: list[dict[str, str]]

Key/value metadata stored with the file.