hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.18k stars 2.77k forks source link

SQL Server: Stored Procedures #9564

Open marionschleifer opened 1 year ago

marionschleifer commented 1 year ago

Feature Description

Track stored procedures saved in your database and expose and enable them as types in the Hasura GraphQL schema.

User value / outcome

Support for stored procedures enables a wide range of use cases, providing more flexibility and power for developers when working with GraphQL APIs. Some of these use cases include:

  1. Complex business logic: Encapsulate complicated business logic within stored procedures to simplify your GraphQL API and improve maintainability. This can help to offload some of the logic from the application layer to the database layer.
  2. Performance optimization: Use stored procedures to optimize performance by reducing the number of round-trips between the application and the database. This can be especially useful for aggregating, filtering, or sorting large datasets.
  3. Data validation and transformation: Implement custom data validation and transformation rules within stored procedures. This can help to ensure data consistency and integrity across different parts of your application.
  4. Access control and security: Enforce granular access control policies and implement custom security logic using stored procedures. This can provide an additional layer of protection for your data, especially when dealing with sensitive information.
  5. Batch operations: Perform batch operations, such as inserting, updating, or deleting multiple records, using stored procedures. This can help improve the efficiency and performance of your application by reducing the number of database calls.
  6. Transaction management: Utilize stored procedures to manage complex, multi-step transactions, ensuring that all operations are either completed successfully or rolled back in case of an error. This can help to maintain data consistency and integrity in your application.
  7. Caching and materialized views: Implement caching and materialized view logic within stored procedures to improve query performance and reduce the load on your database.

By adding support for stored procedures, Hasura would enable developers to leverage these powerful database features, making it even easier to build performant, secure, and scalable GraphQL APIs.

Current status (design, alpha, beta etc.)

TBD

Resources (e.g. RFCs)

rsd1122 commented 1 year ago

Related issue: https://github.com/hasura/graphql-engine/issues/7073

dameleney commented 1 year ago

Support for SQL Server Stored Procedures is now available. Check out the docs to learn more. https://hasura.io/docs/latest/schema/ms-sql-server/logical-models/stored-procedures/