LogoLogo
HomeGitHub RepoBook Demo
dev
dev
  • About Quilt
  • Architecture
  • Mental Model
  • Metadata Management
  • Metadata Workflows
  • Quilt Platform (Catalog) User
    • About the Catalog
    • Bucket Browsing
    • Document Previews
    • Embeddable iFrames
    • Packaging Engine
    • Query
    • Quilt+ URIs
    • Qurator Omni
    • Search
    • Visualization & Dashboards
    • Advanced
      • Athena
      • Elasticsearch
      • Removing Stacks
  • Quilt Platform Administrator
    • Admin Settings UI
    • Catalog Configuration
    • Cross-Account Access
    • Enterprise Installs
    • quilt3.admin Python API
    • Advanced
      • Package Events
      • Private Endpoints
      • Restrict Access by Bucket Prefix
      • S3 Events via EventBridge
      • SSO Permissions Mapping
      • Tabulator
      • Troubleshooting
        • SSO Redirect Loop
    • Best Practices
      • GxP for Security & Compliance
      • Organizing S3 Buckets
  • Quilt Python SDK
    • Installation
    • Quick Start
    • Editing a Package
    • Uploading a Package
    • Installing a Package
    • Getting Data from a Package
    • Example: Git-like Operations
    • API Reference
      • quilt3
      • quilt3.Package
      • quilt3.Bucket
      • quilt3.hooks
      • Local Catalog
      • CLI, Environment
      • Known Limitations
      • Custom SSL Certificates
    • Advanced
      • Browsing Buckets
      • Filtering a Package
      • .quiltignore
      • Manipulating Manifests
      • Materialization
      • S3 Select
    • More
      • Changelog
      • Contributing
      • Frequently Asked Questions
      • Troubleshooting
  • Quilt Ecosystem Integrations
    • Benchling Packager
    • Event-Driven Packaging
    • Nextflow Plugin
Powered by GitBook
On this page
  • Bucket.search(self, query: Union[str, dict], limit: int = 10) -> List[dict]
  • Bucket.put_file(self, key, path)
  • Bucket.put_dir(self, key, directory)
  • Bucket.keys(self)
  • Bucket.delete(self, key)
  • Bucket.delete_dir(self, path)
  • Bucket.ls(self, path=None, recursive=False)
  • Bucket.fetch(self, key, path)
  • Bucket.select(self, key, query, raw=False)

Was this helpful?

  1. Quilt Python SDK
  2. API Reference

quilt3.Bucket

Previousquilt3.PackageNextquilt3.hooks

Last updated 11 months ago

Was this helpful?

Bucket interface for Quilt.

__init__

Creates a Bucket object.

Arguments

  • bucket_uri(str): URI of bucket to target. Must start with 's3://'

Returns

A new Bucket

Bucket.search(self, query: Union[str, dict], limit: int = 10) -> List[dict]

Execute a search against the configured search endpoint.

Arguments

  • query: query string to query if passed as str, DSL query body if passed as dict

  • limit: maximum number of results to return. Defaults to 10

Query Syntax:

Returns

search results

Bucket.put_file(self, key, path)

Stores file at path to key in bucket.

Arguments

  • key(str): key in bucket to store file at

  • path(str): string representing local path to file

Returns

None

Raises

  • if no file exists at path

  • if copy fails

Bucket.put_dir(self, key, directory)

Stores all files in the directory under the prefix key.

Arguments

  • key(str): prefix to store files under in bucket

  • directory(str): path to directory to grab files from

Returns

None

Raises

  • if writing to bucket fails

Bucket.keys(self)

Lists all keys in the bucket.

Returns

List of strings

Bucket.delete(self, key)

Deletes a key from the bucket.

Arguments

  • key(str): key to delete

Returns

None

Raises

  • if delete fails

Bucket.delete_dir(self, path)

Delete a directory and all of its contents from the bucket.

Arguments

  • path (str): path to the directory to delete

Bucket.ls(self, path=None, recursive=False)

List data from the specified path.

Arguments

  • path (str): bucket path to list

  • recursive (bool): show subdirectories and their contents as well

Returns

list: Return value structure has not yet been permanently decided Currently, it's a tuple of list objects, containing the following: (directory info, file/object info, delete markers).

Bucket.fetch(self, key, path)

Fetches file (or files) at key to path.

If key ends in '/', then all files with the prefix key will match and will be stored in a directory at path.

Otherwise, only one file will be fetched and it will be stored at path.

Arguments

  • key(str): key in bucket to fetch

  • path(str): path in local filesystem to store file or files fetched

Returns

None

Raises

  • if path doesn't exist

  • if download fails

Bucket.select(self, key, query, raw=False)

Selects data from an S3 object.

Arguments

  • key(str): key to query in bucket

  • query(str): query to execute (SQL by default)

  • query_type(str): other query type accepted by S3 service

  • raw(bool): return the raw (but parsed) response

Returns

pandas.DataFrame: results of query

Query String Query
Query DSL