MyScale is a cloud-based database optimized for AI applications and solutions, built on the open-source ClickHouse.This notebook shows how to use functionality related to the
MyScale vector database.
Setting up environments
OpenAIEmbeddings so we have to get the OpenAI API Key.
-
Environment Variables
Before you run the app, please set the environment variable with
export:export MYSCALE_HOST='<your-endpoints-url>' MYSCALE_PORT=<your-endpoints-port> MYSCALE_USERNAME=<your-username> MYSCALE_PASSWORD=<your-password> ...You can easily find your account, password and other info on our SaaS. For details please refer to this document Every attributes underMyScaleSettingscan be set with prefixMYSCALE_and is case insensitive. -
Create
MyScaleSettingsobject with parameters
Get connection info and data schema
Filtering
You can have direct access to myscale SQL where statement. You can writeWHERE clause following standard SQL.
NOTE: Please be aware of SQL injection, this interface must not be directly called by end-user.
If you customized your column_map under your setting, you search with filter like this:
Similarity search with score
The returned distance score is cosine distance. Therefore, a lower score is better.Deleting your data
You can either drop the table with.drop() method or partially delete your data with .delete() method.
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.