Built-in Storage
Databutton provides built-in storage capabilities out of the box.
All operations, such as storing and retrieving data, are managed by the Databutton Agent using Databutton's own Python SDK.
File Types: Store and Retrieve
Commonly used file types for storage and retrieval are jotted down below.
File Type
Store Method
Retrieve Method
Description
Text Files
db.storage.text.put()
db.storage.text.get()
Handle plain text-based files like .txt
, .html
, or .md
.
JSON Files
db.storage.json.put()
db.storage.json.get()
Save JSON files as Python dictionaries.
Binary Files
db.storage.binary.put()
db.storage.binary.get()
Save raw binary files or any unknown file types as Python byte objects.
Dataframes
db.storage.dataframes.put()
db.storage.dataframes.get()
Store and retrieve tabular data, such as CSV files, in Pandas DataFrame format.
Pickled Objects
db.storage.binary.put()
db.storage.binary.get()
Store Python objects serialized with pickle
.
Other File Types
db.storage.binary.put()
db.storage.binary.get()
Manage custom or unknown file types using binary storage methods.
How the Databutton Agent Performs Operations
The Databutton Agent simplifies the process of storing and retrieving files by leveraging Databutton's internal Python SDK. The agent uses simple methods like put()
and get()
Example prompt to store data:
FAQs: Databutton Built-in Storage
Hands-On with Databutton Storage
Uploading a CSV File
Once uploaded, Databutton automatically converts the CSV file into a Pandas dataframe and enables visualization of the dataframe within an interactive AgGrid table
Prompting the Agent to read CSV files in storage
To read a CSV file stored in Databuttonโs internal storage, simply prompt the agent, e.g., "Hi, can you read the #storage-dataframe-storage/dummy-data-csv and let me know its content?" The Databutton Agent will use the internal SDK to locate and read the file, then display its content directly in the chat.
Using Files from Databutton's Internal Storage
Files stored in Databutton's internal storage are accessible only via the backend. To use them in the frontend, you need to first create a backend function to handle the file, and then pass the processed data to the frontend.
Example Prompt: "Hi! Can you write a backend that would read the #storage-dataframe-storage/dummy-data-csv, extract the data, and put it in the #page/Home?"
The Databutton Agent will:
Write a backend function to read the CSV file using the internal storage methods.
Process the data in the backend.
Pass the extracted data to the specified frontend page for display or further interaction.
Last updated