Skip to content

docs(hana): add HANA dialect #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/_fragments/_uuid-support-table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { DialectTableFilter } from '@site/src/components/dialect-table-filter.ts

<DialectTableFilter>

| | PostgreSQL | MariaDB | MySQL | MSSQL | SQLite | Snowflake | db2 | ibmi |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------ | --------- | --- | ---- |
| `uuidV1` | [`uuid_generate_v1`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | [`UUID`](https://mariadb.com/kb/en/uuid/) | [`UUID`](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid) | N/A | N/A | N/A | N/A | N/A |
| `uuidV4` | **pg >= v13**: [`gen_random_uuid`](https://www.postgresql.org/docs/current/functions-uuid.html) <br/>**pg &lt; v13**: [`uuid_generate_v4`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | N/A | N/A | [`NEWID`](https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-ver16) | N/A | N/A | N/A | N/A |
| | PostgreSQL | MariaDB | MySQL | MSSQL | SQLite | Snowflake | db2 | ibmi | SAP HANA |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------ | --------- | --- | ---- | -------- |
| `uuidV1` | [`uuid_generate_v1`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | [`UUID`](https://mariadb.com/kb/en/uuid/) | [`UUID`](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid) | N/A | N/A | N/A | N/A | N/A | N/A |
| `uuidV4` | **pg >= v13**: [`gen_random_uuid`](https://www.postgresql.org/docs/current/functions-uuid.html) <br/>**pg &lt; v13**: [`uuid_generate_v4`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | N/A | N/A | [`NEWID`](https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-ver16) | N/A | N/A | N/A | N/A | N/A |

</DialectTableFilter>
59 changes: 59 additions & 0 deletions docs/databases/hana.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: SAP HANA
sidebar_position: 1
---

# Sequelize for SAP HANA

:::info Version Compatibility

See [Releases](/releases#sap-hana-support-table) to see which versions of SAP HANA are supported.

:::

To use Sequelize with SAP HANA, you need to install the `@sequelize/hana` dialect package:

```bash npm2yarn
npm i @sequelize/hana
```

Then use the `HanaDialect` class as the dialect option in the Sequelize constructor:

```ts
import { Sequelize } from '@sequelize/core';
import { HanaDialect } from '@sequelize/hana';

const sequelize = new Sequelize({
dialect: HanaDialect,
database: 'mydb',
user: 'myuser',
password: 'mypass',
host: 'localhost',
port: 443,
});
```

## Connection Options

import ConnectionOptions from './_connection-options.md';

<ConnectionOptions />

The following options are accepted by the SAP HANA dialect:

| Option | Description |
| --------------- | ------------------------------------------------------------------------ |
| `host` | Specifies the name of the host to connect to. |
| `port` | Specifies the port number to connect to. |
| `database` | Specifies the name of the database to connect to. |
| `user` | Specifies the name of an SAP HANA database user. |
| `password` | Specifies the password for the SAP HANA database user. |
| `currentSchema` | Sets the current schema, which is used for identifiers without a schema. |

:::info

Sequelize uses the [`@sap/hana-client`](https://www.npmjs.com/package/@sap/hana-client) package to connect to SAP HANA.
Most of the above options are provided as-is to the `@sap/hana-client` package,
and you can find more information about them in the [@sap/hana-client documentation](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4fe9978ebac44f35b9369ef5a4a26f4c.html).

:::
Loading