|
29 | 29 | "\n", |
30 | 30 | " * [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n", |
31 | 31 | " * [Enable the Cloud SQL Admin API.](https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com)\n", |
32 | | - " * [Create a Cloud SQL instance.](https://cloud.google.com/sql/docs/mysql/connect-instance-auth-proxy#create-instance) (version must be >= 8.0.36)\n", |
| 32 | + " * [Create a Cloud SQL instance.](https://cloud.google.com/sql/docs/mysql/connect-instance-auth-proxy#create-instance) (version must be >= **8.0.36** with **cloudsql_vector** database flag configured to \"On\")\n", |
33 | 33 | " * [Create a Cloud SQL database.](https://cloud.google.com/sql/docs/mysql/create-manage-databases)\n", |
34 | 34 | " * [Add a User to the database.](https://cloud.google.com/sql/docs/mysql/create-manage-users)" |
35 | 35 | ] |
|
154 | 154 | }, |
155 | 155 | "source": [ |
156 | 156 | "### Set Cloud SQL database values\n", |
157 | | - "Find your database values, in the [Cloud SQL Instances page](https://console.cloud.google.com/sql?_ga=2.223735448.2062268965.1707700487-2088871159.1707257687)." |
| 157 | + "Find your database values, in the [Cloud SQL Instances page](https://console.cloud.google.com/sql?_ga=2.223735448.2062268965.1707700487-2088871159.1707257687).\n", |
| 158 | + "\n", |
| 159 | + "**Note:** MySQL vector support is only available on MySQL instances with version **>= 8.0.36**.\n", |
| 160 | + "\n", |
| 161 | + "For existing instances, you may need to perform a [self-service maintenance update](https://cloud.google.com/sql/docs/mysql/self-service-maintenance) to update your maintenance version to **MYSQL_8_0_36.R20240401.03_00** or greater. Once updated, [configure your database flags](https://cloud.google.com/sql/docs/mysql/flags) to have the new **cloudsql_vector** flag to \"On\"." |
158 | 162 | ] |
159 | 163 | }, |
160 | 164 | { |
|
237 | 241 | "source": [ |
238 | 242 | "engine.init_vectorstore_table(\n", |
239 | 243 | " table_name=TABLE_NAME,\n", |
240 | | - " vector_size=768, # Vector size for VertexAI model(textembedding-gecko@latest),\n", |
| 244 | + " vector_size=768, # Vector size for VertexAI model(textembedding-gecko@latest)\n", |
241 | 245 | ")" |
242 | 246 | ] |
243 | 247 | }, |
|
439 | 443 | }, |
440 | 444 | "source": [ |
441 | 445 | "### Add an index\n", |
442 | | - "Speed up vector search queries by applying a vector index. Learn more about [MySQL vector indexes](https://github.com/googleapis/langchain-google-cloud-sql-mysql-python/blob/main/src/langchain_google_cloud_sql_mysql/indexes.py)." |
| 446 | + "Speed up vector search queries by applying a vector index. Learn more about [MySQL vector indexes](https://github.com/googleapis/langchain-google-cloud-sql-mysql-python/blob/main/src/langchain_google_cloud_sql_mysql/indexes.py).\n", |
| 447 | + "\n", |
| 448 | + "**Note:** For IAM database authentication (default usage), the IAM database user will need to be granted the following permissions by a privileged database user for full control of vector indexes.\n", |
| 449 | + "\n", |
| 450 | + "```\n", |
| 451 | + "GRANT EXECUTE ON PROCEDURE mysql.create_vector_index TO '<IAM_DB_USER>'@'%';\n", |
| 452 | + "GRANT EXECUTE ON PROCEDURE mysql.alter_vector_index TO '<IAM_DB_USER>'@'%';\n", |
| 453 | + "GRANT EXECUTE ON PROCEDURE mysql.drop_vector_index TO '<IAM_DB_USER>'@'%';\n", |
| 454 | + "GRANT SELECT ON mysql.vector_indexes TO '<IAM_DB_USER>'@'%';\n", |
| 455 | + "```" |
443 | 456 | ] |
444 | 457 | }, |
445 | 458 | { |
|
0 commit comments