Hello Phoenix Team. I am trying out Phoenix for RAG tracing. I'm reaching out for some assistance with Phoenix regarding the location of the SQLite database. I have configured the PHOENIX_WORKING_DIR environment variable in my .env file to /Volumes/Work/RnD/Phoenix_with_llama_index. I have also added the following code to my ipynb notebook to load the environment variables:
from dotenv import load_dotenv
import os
# Load environment variables from .env file
load_dotenv()
# Access the PHOENIX_WORKING_DIR environment variable
phoenix_working_directory = os.getenv('PHOENIX_WORKING_DIR')
print(f"PHOENIX_WORKING_DIR: {phoenix_working_directory}")This produces the output: PHOENIX_WORKING_DIR: /Volumes/Work/RnD/Phoenix_with_llama_index. I have run the RAG pipeline with several questions, and I can see that exports, inferences, and trace_dataset folders have been created in the specified working directory. However, the documentation states: "By default, Phoenix uses SQLite, storing data in ~/.phoenix/ or the directory specified by the PHOENIX_WORKING_DIR environment variable." I am unable to locate the SQLite database file. Could you please guide me on where to find it?"
Setting the PHOENIX_WORKING_DIR environment variable determines where Phoenix stores its SQLite database and related data. By default, Phoenix will create a file named phoenix.db in the directory specified by PHOENIX_WORKING_DIR (e.g., /Volumes/Work/RnD/Phoenix_with_llama_index/phoenix.db) if you are using SQLite as the backend. This directory must be accessible by both the Phoenix server and your notebook environment. If you do not specify PHOENIX_SQL_DATABASE_URL, Phoenix will use SQLite in the working directory you set. To ensure persistence, make sure you launch Phoenix with use_temp_dir=False (e.g., px.launch_app(use_temp_dir=False)), otherwise it may use a temporary directory and not your specified path. For more, see Phoenix self-hosting configuration and session API docs. Would you like more detail on troubleshooting or verifying the database location?Sources: - Phoenix self-hosting configuration - session API docs - Phoenix Self-Hosting Guide - Phoenix Docker deployment example - Slack discussion: use_temp_dir
💡 Hint: Mention RunLLM in the thread for followups.
RunLLM Based on further review of the documentation, it was suggested that I explicitly set the :
PHOENIX_WORKING_DIR=/Volumes/Work/RnD/Phoenix_with_llama_index
PHOENIX_SQL_DATABASE_URL=sqlite:////Volumes/Work/RnD/Phoenix_with_llama_index/phoenix.sqliteI updated my ipynb notebook to include the full path for load_dotenv and to also print the PHOENIX_SQL_DATABASE_URL:
from dotenv import load_dotenv
import os
# Load environment variables from .env file
load_dotenv('/Volumes/Work/RnD/Phoenix_with_llama_index/.env')
# Access the PHOENIX_WORKING_DIR environment variable (optional, for verification)
phoenix_working_directory = os.getenv('PHOENIX_WORKING_DIR')
phoenix_sql_database_url = os.getenv('PHOENIX_SQL_DATABASE_URL')
print(f"PHOENIX_WORKING_DIR: {phoenix_working_directory}")
print(f"PHOENIX_SQL_DATABASE_URL: {phoenix_sql_database_url}")When I run this code, the output correctly shows that both environment variables are being fetched:
PHOENIX_WORKING_DIR: /Volumes/Work/RnD/Phoenix_with_llama_index
PHOENIX_SQL_DATABASE_URL: sqlite:////Volumes/Work/RnD/Phoenix_with_llama_index/phoenix.sqliteDespite PHOENIX_SQL_DATABASE_URL now pointing to sqlite:////Volumes/Work/RnD/Phoenix_with_llama_index/phoenix.sqlite, I am still unable to find the phoenix.sqlite database file in the specified directory after running the RAG pipeline. The exports, inferences, and trace_dataset folders are present, but not the SQLite database. Could you please advise on why the database file is not being created or where else I should look for it?
If PHOENIX_SQL_DATABASE_URL is set to sqlite:////Volumes/Work/RnD/Phoenix_with_llama_index/phoenix.sqlite and the file is not created, it may be due to Phoenix running in a temporary directory or not persisting traces. Ensure you launch Phoenix with use_temp_dir=False (e.g., px.launch_app(use_temp_dir=False)), otherwise it may default to a temp location and not use your specified path. Also, verify that your notebook and Phoenix process have write permissions to the target directory and that no other conflicting environment variables are set.If the database file still does not appear, check for errors in the Phoenix server logs and confirm that the process is not using an in-memory or temp SQLite database. For more, see Phoenix self-hosting configuration and Slack discussion on persistence. Would you like step-by-step troubleshooting instructions?Sources: - Phoenix self-hosting configuration
💡 Hint: Mention RunLLM in the thread for followups.
RunLLM Solved
If you tell me the right answer to this question, I'll make sure I don't make the same mistake twice!
Feedback
Type the right answer here...
↵ Please 'enter' to submit
🔒[private user] 🔒[private user] I'm working with a setup where I have two separate services deployed on Google Cloud Run: 1. A Streamlit chat application. This app sends traces. 2. A Phoenix collector deployed from Docker Hub, which receives these traces. My goal is to switch the backend database for my *Phoenix Cloud Run instance* from the default SQLite to a MySQL 8.0 instance on Google Cloud SQL. For database configuration, I have included the following line in my Streamlit chat application's app.py file**: os.environ["PHOENIX_SQL_DATABASE_URL"] = "mysql+pymysql://phoenix:1234@[MYSQL_HOST_IP]/phoenix-tracing" I have currently included the above line My question is: 1. What is the recommended best practice for setting the `PHOENIX_SQL_DATABASE_URL` when deploying Phoenix itself to Google Cloud Run? Should it be set directly on the Cloud Run service as an environment variable, and if so, how is this typically done via CLI for a pre-built Docker image from Docker Hub? 2. Once deployed, how can I reliably confirm (e.g., via specific log messages or other diagnostic tools) that my Phoenix Cloud Run service has successfully connected to and is using the MySQL database for data storage? Any guidance on the proper configuration for the Phoenix Cloud Run service and verification methods would be greatly appreciated!
The Phoenix documentation I have ingested does not mention how to configure Phoenix to use MySQL as a backend database, nor does it provide guidance on setting PHOENIX_SQL_DATABASE_URL for MySQL or verifying MySQL connectivity in Cloud Run deployments. The documentation and official examples only reference SQLite and PostgreSQL as supported databases for Phoenix, with configuration typically done by setting the PHOENIX_SQL_DATABASE_URL environment variable directly on the Phoenix service (such as via the Cloud Run CLI or console), and verification is usually performed by checking Phoenix server logs for successful database connection messages. If you are attempting to use MySQL, please clarify if you have confirmed MySQL compatibility with Phoenix, and consider providing details about any errors or log output you are seeing. If this doesn't help, please reach out to the Phoenix support team for further assistance.
💡 Hint: Mention RunLLM in the thread for followups.
Thank you so much 🔒[private user]! cc: 🔒[private user] 🔒[private feed] I am not sure, but I saw this line in the Phoenix documentation: DB SG → allows inbound from App SG on 5432 (Postgres) or 3306 (MySQL) https://github.com/Arize-ai/phoenix/blob/42c2b07464008008eaca2cd0f03d0094eeb05c3f/docs/section-self-hosting/deployment-options/aws-with-cloudformation.md?plain=1#L338. This seemed to imply MySQL might be supported. However, it's about network configuration within AWS CloudFormation for subnet segmentation and security groups per tier, mentioning that the DB security group allows inbound connections on port 3306 for MySQL. Not sure for Google Cloud though. Any further guidance would be really helpful!
🔒[private user] Thank you so much for the response! I understand. Currently, I have switched to PostgreSQL and was successfully able to connect the Cloud sideDB with the Phoenix microservice
