Skip to main content

PostgreSQL

Library of functions for accessing PostgreSQL.

Functions

InferAndQuery

Performs a query in a PostgreSQL database with schema detection (inference).

Syntax:
PostgreSQL.InferAndQuery(database: string, query: string, host: optional string, port: optional int, username: optional string, password: optional string)
Parameters
  • database: The name of the database to read. If the database credentials are stored in the credentials storage, then this parameter receives the name of the credential.

  • query: The query to execute in the database.

  • host: The database server hostname. Can only be used if not using registered credentials.

  • port: The database server port. Can only to be used together with 'host' argument.

  • username: The database user name. Can only to be used together with 'host' argument.

  • password: The database user password. Can only to be used together with 'host' and 'username' arguments.

Returns
  • collection: A table with the data read from the PostgreSQL table.
Example:
PostgreSQL.InferAndQuery("database", "SELECT * FROM schema.table")

InferAndRead

Reads a PostgreSQL table with schema detection (inference).

Syntax:
PostgreSQL.InferAndRead(database: string, schema: string, table: string, host: optional string, port: optional int, username: optional string, password: optional string)
Parameters
  • database: The name of the database to read. If the database credentials are stored in the credentials storage, then this parameter receives the name of the credential.

  • schema: The database schema name.

  • table: The name of the table.

  • host: The database server hostname. Can only be used if not using registered credentials.

  • port: The database server port. Can only to be used together with 'host' argument.

  • username: The database user name. Can only to be used together with 'host' argument.

  • password: The database user password. Can only to be used together with 'host' and 'username' arguments.

Returns
  • collection: A table with the data read from the PostgreSQL table.
Example:
PostgreSQL.InferAndRead("database", "schema", "table")

Query

Performs a query in a PostgreSQL database.

Syntax:
PostgreSQL.Query(database: string, query: string, type: type, host: optional string, port: optional int, username: optional string, password: optional string)
Parameters
  • database: The name of the database to read. If the database credentials are stored in the credentials storage, then this parameter receives the name of the credential.

  • query: The query to execute in the database.

  • type: The type of the query result.

  • host: The database server hostname. Can only be used if not using registered credentials.

  • port: The database server port. Can only to be used together with 'host' argument.

  • username: The database user name. Can only to be used together with 'host' argument.

  • password: The database user password. Can only to be used together with 'host' and 'username' arguments.

Returns
  • collection: A table with the data read from the PostgreSQL table.
Example:
PostgreSQL.Query("database", "SELECT a, b FROM schema.table", type collection(record(a: int, b: string)))

Read

Reads a PostgreSQL table.

Syntax:
PostgreSQL.Read(database: string, schema: string, table: string, type: type, host: optional string, port: optional int, username: optional string, password: optional string)
Parameters
  • database: The name of the database to read. If the database credentials are stored in the credentials storage, then this parameter receives the name of the credential.

  • schema: The database schema name.

  • table: The name of the table.

  • type: The type of the table.

  • host: The database server hostname. Can only be used if not using registered credentials.

  • port: The database server port. Can only to be used together with 'host' argument.

  • username: The database user name. Can only to be used together with 'host' argument.

  • password: The database user password. Can only to be used together with 'host' and 'username' arguments.

Returns
  • collection: A table with the data read from the PostgreSQL table.
Example:
PostgreSQL.Read("database", "schema", "table", type record(id: int, name: string, salary: double))