Skip to content

Script Development / Connector Object DFF.CONN / Overview

After creating a Connector, you can call DFF.CONN(connector_id, **kwargs) in code to obtain the operation object of the specified Connector.

Parameter Type Required / Default Description
connector_id str Required Connector ID
**kwargs - - Overrides part of the configuration for this operation object; supported scope depends on the Connector type

Optional parameters whose value is None or a blank string are ignored. When no optional parameter is passed, the operation object uses the configuration saved in the Connector or the code default value.

Example
1
2
3
4
@DFF.API('InfluxDB Operation Demo')
def influxdb_demo():
    db = DFF.CONN('demo_influxdb')
    return db.query('SELECT * FROM demo LIMIT 3')

Optional parameters supported by each Connector are as follows:

Connector Type Optional Parameters Description
GuanceCloud, TrueWatch timeout HTTP request timeout, default 10 seconds
DataKit source, timeout, split_size Override Source, request timeout, and batch split size
DataWay token, timeout, split_size Override Token, request timeout, and batch split size
DataFlux Func Sidecar timeout HTTP request timeout, default 10 seconds
InfluxDB database Override the default database
MySQL database Override the default database
Redis database, client_name Override the database number and Redis client name
Memcached - No optional parameters
ClickHouse database Override the default database
Oracle Database database Override the service name
Microsoft SQL Server database Override the default database
PostgreSQL database Override the default database
MongoDB database Override the default database
Elasticsearch timeout HTTP request timeout, default 10 seconds
NSQ timeout HTTP request timeout, default 10 seconds
MQTT Broker, Kafka - No optional parameters
Prometheus timeout HTTP request timeout, default 10 seconds
Alibaba Cloud Log Service SLS - No optional parameters
LLM model, timeout Override the default model; request timeout defaults to 60 seconds

Only the parameters listed in the table above affect the corresponding operation object. Although other extra parameters can be accepted by the calling entry, the Connector implementation does not use them.

Overriding Database

For database-type Connectors, when a default database is configured, queries will be executed in the default database. If this operation needs to use another database, you can pass database when obtaining the Connector operation object:

Python
1
db = DFF.CONN('demo_influxdb', database='my_database')

For Connectors that support the database parameter, refer to the parameter table. For Connectors that do not support this parameter, if you need to operate on another database, create a different Connector.

Overriding DataWay Token

DataWay can override the Token stored in the Connector when obtaining the operation object:

Python
1
dataway = DFF.CONN('df_dataway', token='xxxxx')

Operation objects returned by different types of Connectors have different methods. For specific interfaces, refer to the corresponding Connector documentation.