Skip to content

Script Development / PostgreSQL

The PostgreSQL Connector primarily provides methods to operate on PostgreSQL.
This Connector supports the following databases:

  • Greenplum Database
  • Alibaba Cloud PolarDB MySQL
  • Alibaba Cloud AnalyticDB (ADB) PostgreSQL Edition

DFF.CONN(...) parameters are as follows:

Parameter Type Required / Default Description
connector_id str Required Connector ID
database str None Specified database

.query(...)

Executes SQL statements, with the following parameters:

Parameter Type Required / Default Description
sql str Required SQL statement, which may include parameter placeholders.
? represents escaped parameters;
?? represents non-escaped parameters
sql_params list None SQL parameters
Example
1
2
3
sql = 'SELECT * FROM ?? WHERE seq > ?'
sql_params = ['demo', 1]
result = db.query(sql, sql_params=sql_params)

Dynamic SQL Statements

query(...) and non_query(...) internally use DFF.SQL(...) to construct SQL statements and support building complex dynamic SQL statements.

For example, WHERE IN (...) with an uncertain number of values, or INSERT INTO ... VALUES ... for batch data insertion.

For details, please refer to Script Development / SQL Construction DFF.SQL