-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Description
Feature Description
TypeORM currently provides support for SAP HANA via the community-maintained SAP HANA driver. While this works well for standalone HANA database instances, it does not support SAP HANA Deployment Infrastructure (HDI) containers, which are the standard way to manage persistence in SAP BTP Cloud Foundry environments.
Problem Statement:
In SAP BTP, developers primarily interact with HANA via HDI containers, which provide isolated schemas and lifecycle-managed artifacts. However, TypeORM's current HANA support assumes a traditional database connection and lacks:
Awareness of HDI schema isolation
Support for technical users (Design-Time / Run-Time) and schema resolution
Integration with HDI service bindings (e.g., credentials from VCAP_SERVICES in cloud foundry )
The Solution
Extend the existing SAP HANA driver in TypeORM to support HDI container compatibility, including:
Support for dynamic schema injection based on connection options or environment variables (e.g., from VCAP_SERVICES or .env).
Allow a new flag like hdi: true in the connection config to activate HDI-specific behavior.
Ensure that all TypeORM-generated queries are either:
Executed within the HDI container’s schema context (SET SCHEMA), or
Schema-qualified based on the container's schema name.
Support HDI technical users (Design-Time and Run-Time) by respecting their access privileges and avoiding assumptions made for full-database users.
Optionally integrate with Cloud Foundry service bindings (VCAP_SERVICES) to streamline configuration in SAP BTP environments.
Considered Alternatives
Direct SQL using @sap/hana-client or hdbcli:
These libraries allow raw SQL execution against HDI containers, but they lack ORM features like entity mapping, migrations, and decorators, leading to more boilerplate and less maintainable code.
Manual schema injection into TypeORM:
Setting the HDI container schema manually using SET SCHEMA or schema-qualified table names ("MY_HDI_SCHEMA"."MyTable") partially works, but it breaks portability, entity naming conventions, and automatic schema sync features in TypeORM.
Using external tooling for HDI deployment (e.g., CAP or MTA):
These tools work well for defining HDI artifacts but do not offer the flexibility of runtime-driven ORM entity creation and manipulation, which is essential for dynamic or programmatic models in Node.js apps.
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.