Operations (sample payloads)

Main operations
Copy

Count rows
Copy

Counts the number of rows that meet a given set of conditions.

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz789.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!",
8
"table": "customers",
9
"conditions": [
10
{
11
"field": "country",
12
"operator": "equal to",
13
"value": "USA"
14
},
15
{
16
"field": "age",
17
"operator": "greater than",
18
"value": 18
19
}
20
]
21
}

Sample Output

1
{
2
"count": 1250
3
}

Delete rows
Copy

Deletes rows in your database based on criteria of your choosing.

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz789.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!",
8
"table": "customers",
9
"conditions": [
10
{
11
"field": "last_purchase_date",
12
"operator": "less than",
13
"value": "2022-01-01"
14
},
15
{
16
"field": "status",
17
"operator": "equal to",
18
"value": "inactive"
19
}
20
]
21
}

Sample Output

1
{
2
"count": 15,
3
"deleted": true
4
}

Find rows
Copy

Find rows in your database based on criteria of your choosing.

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "ticketdb",
5
"schema": "public",
6
"user": "admin",
7
"password": "SecurePassword123!",
8
"table": "listings",
9
"fields": [
10
"listid",
11
"sellerid",
12
"eventid",
13
"numtickets",
14
"totalprice"
15
],
16
"conditions": [
17
{
18
"field": "eventid",
19
"operator": "equal to",
20
"value": 1234
21
},
22
{
23
"field": "numtickets",
24
"operator": "greater than",
25
"value": 2
26
}
27
],
28
"limit": 10,
29
"offset": 0
30
}

Sample Output

1
{
2
"rows": [
3
{
4
"listid": 5001,
5
"sellerid": 101,
6
"eventid": 1234,
7
"numtickets": 4,
8
"totalprice": "240.00"
9
},
10
{
11
"listid": 5002,
12
"sellerid": 102,
13
"eventid": 1234,
14
"numtickets": 3,
15
"totalprice": "180.00"
16
},
17
{
18
"listid": 5003,
19
"sellerid": 103,
20
"eventid": 1234,
21
"numtickets": 5,
22
"totalprice": "300.00"
23
}
24
]
25
}

Insert new rows
Copy

Insert one or more rows into your Redshift database.

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz789.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!",
8
"table": "customers",
9
"data": [
10
{
11
"customer_id": 1001,
12
"first_name": "John",
13
"last_name": "Doe",
14
"email": "john.doe@example.com",
15
"phone": "+1-555-123-4567",
16
"created_at": "2023-04-15T10:30:00Z"
17
},
18
{
19
"customer_id": 1002,
20
"first_name": "Jane",
21
"last_name": "Smith",
22
"email": "jane.smith@example.com",
23
"phone": "+1-555-987-6543",
24
"created_at": "2023-04-15T11:45:00Z"
25
}
26
]
27
}

Sample Output

1
{
2
"count": 2,
3
"inserted": true
4
}

Run SQL query
Copy

Execute raw specified SQL code on the chosen database

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz789.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!",
8
"sql": "SELECT * FROM public.users WHERE age > $1 AND city = $2",
9
"sql_parameters": [
10
30,
11
"New York"
12
]
13
}

Sample Output

1
{
2
"count": 3,
3
"result": [
4
{
5
"id": 1,
6
"name": "John Doe",
7
"age": 35,
8
"city": "New York"
9
},
10
{
11
"id": 2,
12
"name": "Jane Smith",
13
"age": 42,
14
"city": "New York"
15
},
16
{
17
"id": 3,
18
"name": "Bob Johnson",
19
"age": 38,
20
"city": "New York"
21
}
22
]
23
}

Update rows
Copy

Updates rows in your database based on criteria of your choosing.

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!",
8
"table": "customers",
9
"data": {
10
"email": "johndoe@example.com",
11
"phone": "+1-555-123-4567"
12
},
13
"conditions": [
14
{
15
"field": "customer_id",
16
"operator": "equal to",
17
"value": 1001
18
}
19
]
20
}

Sample Output

1
{
2
"count": 1,
3
"updated": true
4
}

DDL operations
Copy

List table fields (DDL)
Copy

Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

Sample Input

1
{
2
"host": "redshift-cluster-1.abcdefghijkl.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydatabase",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!"
8
}

Sample Output

1
{}

List tables (DDL)
Copy

Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

Sample Input

1
{
2
"host": "redshift-cluster-1.abc123xyz789.us-west-2.redshift.amazonaws.com",
3
"port": 5439,
4
"database": "mydb",
5
"schema": "public",
6
"user": "admin",
7
"password": "MySecurePassword123!"
8
}

Sample Output

1
{}