CONNECTION
Also known as
connection_name (with or without @ prefix)
Specify a named database connection for the endpoint.
Syntax
@connection <connection-name>
@connection_name <connection-name>Examples
Use Named Connection
comment on function get_analytics() is
'HTTP GET
@connection analytics_db';Reporting Database
comment on function generate_report() is
'HTTP GET
@connection_name reporting';Read Replica
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