PolarDB for AI requires the cluster endpoint — not the primary endpoint — regardless of how you connect. This topic explains which endpoint to use, how to switch to it in Data Management (DMS), and the syntax required for AI SQL statements.
Prerequisites
Before you begin, make sure you have:
A PolarDB cluster with PolarDB for AI enabled
The cluster endpoint of your cluster (not the primary endpoint)
Connect to your cluster
All connection methods — DMS, a client, or the command line — must use the cluster endpoint.

Connect using the command line
To use a hint with the MySQL command line, add the -c flag:
mysql -h localhost -P port -u username -p password -cConnect using DMS
DMS connects to the primary endpoint by default. To switch to the cluster endpoint:
In the left-side navigation pane, choose Database Instance > Instances Connected. Right-click the cluster and select Edit.

Set Entry mode to Connection string address and enter the cluster endpoint.

Click Save.
After you change the Entry mode to Connection string address, you must open a new SQL console to execute SQL statements.
AI SQL statement syntax
AI SQL statements are extended SQL statements that access PolarDB for AI features and models. Every AI SQL statement must begin with the /*polar4ai*/ hint prefix. Statements are recorded in your Alibaba Cloud account's audit logs.
Syntax:
/*polar4ai*/<SQL statement>Example:
/*polar4ai*/CREATE FEATURE test_graph_1 WITH (feature_class='graph') AS (SELECT ip, user_id FROM small_sample LIMIT 30);