CONNECTION
Specify a named database connection for the endpoint.
Keywords
connection, connection_name
Syntax
connection <connection-name>
connection_name <connection-name>Examples
Use Named Connection
sql
comment on function get_analytics() is
'HTTP GET
connection analytics_db';Reporting Database
sql
comment on function generate_report() is
'HTTP GET
connection_name reporting';Read Replica
sql
comment on function read_heavy_query() is
'HTTP GET
connection read_replica';Behavior
- References a connection string defined in
ConnectionStringsconfiguration - Allows different endpoints to use different databases
- Requires
UseMultipleConnections: truein NpgsqlRest options - See Connection Settings configuration
Related
- Connection configuration - Configure database connections
- NpgsqlRest Options configuration - Enable multiple connections
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
Related Annotations
- COMMAND_TIMEOUT - Set query timeout