You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- README: add Features section, fix Getting started to match template
(fivetran init code block + explanation + init docs link), add
Additional files section, add PI AF asset hierarchy explanation,
fix Data handling to say types are explicitly defined not auto-detected
- connector.py: add base_url scheme validation (http/https check);
remove internal ERD link from schema() comment
- models.py: use hashlib.md5(usedforsecurity=False) for FIPS safety
- sync.py: use .get() for Element.WebId to prevent KeyError on
malformed PI Web API responses
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: aveva_pi/README.md
+32-3Lines changed: 32 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,16 @@
4
4
5
5
This connector syncs data from AVEVA PI (formerly OSIsoft PI) to your Fivetran destination. It communicates with the PI system via the PI Web API REST interface — no proprietary ODBC drivers are required, so the connector runs in Fivetran's managed cloud environment without any additional installation.
6
6
7
+
The PI Asset Framework (PI AF) is AVEVA PI's asset hierarchy layer. It organizes physical assets (such as pumps, tanks, or compressors) as *elements*, each with typed *attributes* that can link to PI Point time-series tags. *Event frames* record time-bounded operational events (for example, alarms or batches) against elements in the hierarchy.
8
+
7
9
Key capabilities:
8
10
- REST-based connectivity via PI Web API (HTTPS + Basic auth) — no ODBC driver installation required
9
11
- Four fixed tables: `elements`, `attributes`, `event_frames`, and `recorded_values`
10
12
- Full reimport for `elements` and `attributes` (PI AF asset hierarchy)
11
13
- Cursor-based incremental sync for `event_frames` and `recorded_values` with adaptive time-window backoff
12
14
- 2-hour late-arrival rollback on `recorded_values` to capture values written after their timestamps
13
15
- MD5-based synthetic `_fivetran_id` primary key for `recorded_values`
14
-
- Authentication-aware retry: 4xx responses surface immediately; 5xx / network errors retry up to 3 times
16
+
- Authentication-aware retry: 4xx responses surface immediately; 408/429 and 5xx / network errors retry up to 3 times
15
17
-`recorded_values` sync is opt-in (set `sync_recorded_values = "true"`) because it can generate very large data volumes
16
18
17
19
@@ -30,7 +32,27 @@ Key capabilities:
30
32
31
33
Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connectors/connector-sdk/setup-guide) to get started.
32
34
33
-
Running `fivetran init --template aveva_pi` creates a new Connector SDK project pre-populated with this connector's source files. You can then update `configuration.json` with your PI Web API credentials and run `fivetran debug` to test locally against your own PI server.
35
+
To initialize a new Connector SDK project using this connector as a starting point, run:
36
+
37
+
```
38
+
fivetran init --template aveva_pi
39
+
```
40
+
41
+
`fivetran init` initializes a new Connector SDK project by setting up the project structure, configuration files, and a connector you can run immediately with `fivetran debug`. For more information on `fivetran init`, refer to the [Connector SDK `init` documentation](https://fivetran.com/docs/connector-sdk/connector-development-and-configuration/connector-sdk-commands#fivetraninit).
42
+
43
+
> Note: Ensure you have updated the `configuration.json` file with the necessary parameters before running `fivetran debug`. See the [Configuration file](#configuration-file) section for details on the required configuration parameters.
44
+
45
+
46
+
## Features
47
+
48
+
- REST-based connectivity via PI Web API (HTTPS + Basic auth) — no ODBC driver installation required
49
+
- Four fixed tables: `elements`, `attributes`, `event_frames`, and `recorded_values`
50
+
- Full reimport for `elements` and `attributes` (PI AF asset hierarchy: assets, their attributes, and PI Point data references)
51
+
- Cursor-based incremental sync for `event_frames` and `recorded_values` with adaptive time-window backoff
52
+
- 2-hour late-arrival rollback on `recorded_values` to capture values written after their timestamps
53
+
- Explicit column type definitions in `connector.py` (including `UTC_DATETIME` for all timestamp columns)
54
+
-`recorded_values` sync is opt-in (set `sync_recorded_values = "true"`) because it can generate very large data volumes
55
+
- Authentication-aware retry: 4xx responses surface immediately; 408/429 and 5xx / network errors retry up to 3 times with exponential backoff
34
56
35
57
36
58
## Configuration file
@@ -81,7 +103,7 @@ Checkpointing occurs after each successful time window (incremental) or every 10
81
103
82
104
## Data handling
83
105
84
-
- Schema: Fixed four-table schema. Column types are auto-detected by the Fivetran Connector SDK from the data values upserted during sync.
106
+
- Schema: Fixed four-table schema. Column types are explicitly defined in `connector.py` (for example, `UTC_DATETIME` for all timestamp columns and `BOOLEAN` for the `good` column).
85
107
- Timestamps: PI Web API returns ISO 8601 timestamps. The connector parses them to UTC-aware `datetime` objects before yielding rows to Fivetran.
86
108
- PI digital states: When a PI recorded value is a system digital state (a JSON object like `{"Name": "Shutdown", "Value": 248}`), only the `Name` string is stored in the `value` column.
87
109
- Hash IDs: The `recorded_values` table has no natural primary key. A `_fivetran_id` column is generated as the MD5 hex digest of `attribute_web_id|timestamp`.
@@ -157,6 +179,13 @@ Incremental by `timestamp`. Opt-in via `sync_recorded_values = "true"`. Represen
157
179
|`good`| BOOLEAN ||
158
180
159
181
182
+
## Additional files
183
+
184
+
-`client.py` — HTTP session setup, authenticated API calls with retry/backoff, pagination via `Links.Next`, and AF database discovery.
185
+
-`models.py` — Record extraction helpers that map raw PI Web API response dicts to flat table rows, plus timestamp parsing and MD5 primary key generation.
186
+
-`sync.py` — Per-table sync strategies: full reimport for elements and attributes, cursor-based incremental sync with adaptive time-window backoff for event frames and recorded values.
187
+
188
+
160
189
## Additional considerations
161
190
162
191
The examples provided are intended to help you effectively use Fivetran's Connector SDK. While we've tested the code, Fivetran cannot be held responsible for any unexpected or negative consequences that may arise from using these examples. For inquiries, please reach out to our Support team.
0 commit comments