mysql2 to port 3306,HeatWaveDialect extends MySQLDialect and inherits allRAPID) statements, Auto Parallel Load,| Property | Value |
|---|---|
| Dialect name | heatwave |
| Extends | MySQLDialect |
| Driver | mysql2 |
| Default port | 3306 |
| Cloud SDK | none |
| Local runtime | none — hosted service only |
$ npm install ts-prorm-orm mysql2$ pnpm add ts-prorm-orm mysql2$ yarn add ts-prorm-orm mysql2$ bun add ts-prorm-orm mysql2mysql2 is the same driver the mysql dialect uses.import { Prorm } from 'ts-prorm-orm';
export const db = new Prorm({
dialect: 'heatwave',
host: '10.0.1.23',
database: 'sales',
username: 'admin',
password: process.env.MYSQL_PASSWORD,
});import { Prorm } from 'ts-prorm-orm';
export const db = new Prorm({
dialect: 'heatwave',
url: 'heatwave://admin:secret@10.0.1.23:3306/sales',
});host, port, database, username and password before the dialect is built; any of those passed alongside it wins.import { DataTypes } from 'ts-prorm-orm';
const User = db.define('User', {
id: { type: DataTypes.INTEGER(), primaryKey: true, autoIncrement: true },
email: { type: DataTypes.STRING(255), allowNull: false, unique: true },
name: { type: DataTypes.STRING(100) },
});
await db.sync(); // CREATE TABLE — see Generated SQL belowimport { Op } from 'ts-prorm-orm';
await User.create({ email: 'ada@example.com', name: 'Ada' });
const page = await User.findAll({
where: { name: { [Op.like]: 'A%' } },
order: [['id', 'ASC']],
limit: 20,
offset: 40,
});query(), captured with the driver stubbed out. The model layer inlines the values.db.sync() for the model in the Quick start:CREATE TABLEawait User.create({ email: 'ada@example.com', name: 'Ada' });
await User.update({ name: 'Grace' }, { where: { email: 'ada@example.com' } });
await User.destroy({ where: { id: 1 } });await User.upsert({ id: 1, email: 'ada@example.com', name: 'Ada Lovelace' });upsert() also reads the row by primary key before and after the write, to return the instance.await User.findAll({
where: { name: { [Op.like]: 'A%' } },
order: [['id', 'ASC']],
limit: 20,
offset: 40,
});[!NOTE] No JSON operator in the WHERE builder DataTypes.JSON()maps toJSON, but this dialect's WHERE builder refusesOp.containson it: Cannot render WHERE condition at meta.contains' is not implemented by its WHERE builder. The statement was not sent, because running it without the condition would match rows it should not.
await db.transaction(async (t) => {
await User.create({ email: 'grace@example.com', name: 'Grace' }, { transaction: t });
// A nested transaction is a SAVEPOINT; its failure undoes only its own work.
await db
.transaction(async (sp) => {
await User.destroy({ where: { id: 1 }, transaction: sp });
throw new Error('keep the row');
}, { transaction: t })
.catch(() => {});
});SKIP LOCKED)lock with skipLocked inside a transaction:await db.transaction(async (t) => {
await User.findAll({ where: { name: 'Ada' }, lock: { level: 'UPDATE', skipLocked: true }, transaction: t });
});STRING → VARCHAR(255), auto-increment INTEGER → INT, BOOLEAN → TINYINT(1), DATE → DATETIME, UUID → CHAR(36), JSON → JSON. The type comparison lines the major engines up side by side.const db = new Prorm({
dialect: 'heatwave',
host: '10.0.1.23', // the DB system's private endpoint
username: 'admin',
password: process.env.MYSQL_PASSWORD,
database: 'sales',
});ssl, the dialect sendsssl: { rejectUnauthorized: false }, which encrypts the connection without--ssl-mode=REQUIRED). If the DB system uses atlsCa tossl value, including false, always wins.tls: 'prefer-verify', the implicit default) that unverifiedtlsLogger, defaultconsole.warn):[prorm heatwave] Connection is encrypted but the server certificate is not verified
(ssl.rejectUnauthorized is false): the DB system's default certificate is self-signed.
To verify the server, pass its CA chain (from OCI Certificates) as `tlsCa`. To require
verification instead of falling back, set tls: 'verify'.tls: 'verify' to refuse that fallback outright: with no tlsCa and nossl, connecting throws before any network I/O, naming tlsCa asssl always wins over either mode.new HeatWaveDialect({
host: '10.0.1.23',
tls: 'verify', // throws unless you also pass `tlsCa` or `ssl`
});dialect.tlsPosture() reports the resulting posture without connecting —'verified' (tlsCa, or an explicit ssl that verifies), 'unverified''none' (an explicit ssl that does nottls: 'verify' would refuse the connection outright).HeatWaveDialect extends MySQLDialect (mysql) andObject.getOwnPropertyNames(HeatWaveDialect.prototype),| Area | Overridden |
|---|---|
| Connection and execution | query, resolvePoolConfig |
| Types | buildExcludeColumnSql |
| DDL and schema | createPartitionedTable, createTable |
| Introspection | tableOptions |
| Other | buildHeatwaveLoadSql, buildHeatwaveUnloadSql, buildMlGenerateSql, buildMlModelLoadSql, buildMlModelUnloadSql, buildMlPredictTableSql, buildMlRagSql, buildMlTrainSql, buildSecondaryEngineSql, buildSecondaryLoadSql, buildSecondaryUnloadSql, handleSql, inputList, jsonSql, optionsSql, tlsPosture, warnUnverifiedTlsOnce |
const d = db.dialect as HeatWaveDialect;
await d.createTable('orders', columns, { secondaryEngine: 'RAPID' });
// CREATE TABLE `orders` (...) ENGINE=InnoDB SECONDARY_ENGINE=RAPID
d.buildSecondaryEngineSql('orders'); // ALTER TABLE `orders` SECONDARY_ENGINE = RAPID
d.buildSecondaryEngineSql('orders', null); // ALTER TABLE `orders` SECONDARY_ENGINE = NULL
d.buildSecondaryLoadSql('orders'); // ALTER TABLE `orders` SECONDARY_LOAD
d.buildSecondaryLoadSql('orders', { partitions: ['p0'], guided: false });
// ALTER TABLE `orders` SECONDARY_LOAD PARTITION (`p0`) GUIDED OFF (PARTITION: 9.1.0+, GUIDED: 9.4.1+)
d.buildSecondaryUnloadSql('orders'); // ALTER TABLE `orders` SECONDARY_UNLOAD
d.buildExcludeColumnSql('orders', 'Description', 'BLOB');
// ALTER TABLE `orders` MODIFY `Description` BLOB NOT SECONDARYSECONDARY_ENGINE itself when a table isSECONDARY_UNLOAD only removes the data from the cluster. The InnoDBsys.heatwave_load / sys.heatwave_unload)d.buildHeatwaveLoadSql(['tpch']);
// CALL sys.heatwave_load(JSON_ARRAY('tpch'), NULL)
d.buildHeatwaveLoadSql([{ db: 'tpch', tables: ['orders', 'lineitem'] }], {
mode: 'dryrun',
output: 'compact',
});
// CALL sys.heatwave_load(JSON_ARRAY(JSON_OBJECT('db_name', 'tpch', 'tables', JSON_ARRAY('orders', 'lineitem'))),
// JSON_OBJECT('mode', 'dryrun', 'output', 'compact'))
d.buildHeatwaveUnloadSql([{ db: 'tpch', excludeTables: ['orders'] }]);modenormal/dryrun/validation), output, sqlMode, policy,setLoadParallelism, autoEnc (off/check) and refreshExternalTables.mode (normal/dryrun) and output. Enumerated values ared.buildMlTrainSql('census_data.census_train', 'revenue', '@census_model', {
task: 'classification',
});
// CALL sys.ML_TRAIN('census_data.census_train', 'revenue', JSON_OBJECT('task', 'classification'), @census_model)
d.buildMlModelLoadSql('@census_model'); // CALL sys.ML_MODEL_LOAD(@census_model, NULL)
d.buildMlPredictTableSql('census_data.census_test', '@census_model', 'census_data.predictions');
d.buildMlModelUnloadSql('@census_model');
d.buildMlGenerateSql('What is AI?', { task: 'generation', model_id: 'mistral-7b-instruct-v3' });
// SELECT sys.ML_GENERATE('What is AI?', JSON_OBJECT('task', 'generation', 'model_id', 'mistral-7b-instruct-v3')) AS response
d.buildMlRagSql('What is AutoML', '@output', { vector_store: ['demo_db.demo_embeddings'] });
// CALL sys.ML_RAG('What is AutoML', @output, JSON_OBJECT('vector_store', JSON_ARRAY('demo_db.demo_embeddings')))@name, which is validated) or a handleJSON_OBJECT / JSON_ARRAY calls with every value escaped. The dialectML_TRAIN's task and ML_GENERATE's task. Other keys are passed| Asked for | Why / instead |
|---|---|
A table engine other than InnoDB (option or raw SQL) | DB systems support InnoDB only |
SET GLOBAL / SET PERSIST / SET PERSIST_ONLY | Change variables through a MySQL HeatWave configuration |
CREATE FUNCTION ... SONAME (loadable UDFs) | Not supported; use a stored function |
mysql or sys schemas.capabilitiesOf() (src/transaction-support.ts),whereSupportOf() (src/query-builders/expression-render.ts),sqlObjectCapabilitiesOf() (src/sql-objects/capabilities.ts) and the| Capability | heatwave |
|---|---|
| Transactions atomic | yes |
| Savepoints | yes |
| Isolation | up to SERIALIZABLE |
| Transaction modes | read-only yes; deferrable no; constraint deferral no |
| RETURNING | not emitted; returning is accepted and ignored |
| Upsert | INSERT … ON DUPLICATE KEY UPDATE |
| JSON column | JSON (JSONB → JSON) |
| Vector column | VECTOR(3) |
| Array column | VARCHAR(255) |
| WHERE builder | 28 operator keys plus the $json: prefix; $and/$or/$not; $exists: no; $in subquery: no; expression operands: no |
| SQL objects | family mysql: triggers yes; procedures yes; functions multiStatement; materialized views emulated (procedure); sequences no; enums inline; RLS no |
| Streaming | queryStream() present; LISTEN absent; createExtension() present |
tests/dialects/heatwave.test.ts exercises the dialect with a mocked driver, so nothing touches a server.