dbt-opteryx 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dbt_opteryx-0.1.0/LICENSE +201 -0
- dbt_opteryx-0.1.0/PKG-INFO +164 -0
- dbt_opteryx-0.1.0/README.md +150 -0
- dbt_opteryx-0.1.0/dbt/adapters/opteryx/__init__.py +12 -0
- dbt_opteryx-0.1.0/dbt/adapters/opteryx/__version__.py +1 -0
- dbt_opteryx-0.1.0/dbt/adapters/opteryx/connections.py +80 -0
- dbt_opteryx-0.1.0/dbt/adapters/opteryx/impl.py +50 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/__init__.py +3 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/dbt_project.yml +5 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/macros/adapters.sql +81 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/macros/catalog.sql +23 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/macros/materializations/seed.sql +33 -0
- dbt_opteryx-0.1.0/dbt/include/opteryx/macros/materializations/view.sql +4 -0
- dbt_opteryx-0.1.0/dbt_opteryx.egg-info/PKG-INFO +164 -0
- dbt_opteryx-0.1.0/dbt_opteryx.egg-info/SOURCES.txt +18 -0
- dbt_opteryx-0.1.0/dbt_opteryx.egg-info/dependency_links.txt +1 -0
- dbt_opteryx-0.1.0/dbt_opteryx.egg-info/requires.txt +4 -0
- dbt_opteryx-0.1.0/dbt_opteryx.egg-info/top_level.txt +1 -0
- dbt_opteryx-0.1.0/pyproject.toml +28 -0
- dbt_opteryx-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Justin Joyce (@joocer)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dbt-opteryx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: dbt adapter for Opteryx Cloud (https://opteryx.app)
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: dbt-core<2,>=1.10
|
|
10
|
+
Requires-Dist: dbt-adapters<2,>=1.7
|
|
11
|
+
Requires-Dist: dbt-common<2,>=1.10
|
|
12
|
+
Requires-Dist: opteryx-sqlalchemy>=0.0.13
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# dbt-opteryx
|
|
16
|
+
|
|
17
|
+
dbt adapter for [Opteryx Cloud](https://opteryx.app). It runs dbt Core 1.x against
|
|
18
|
+
Opteryx's HTTP jobs API, using the DBAPI from
|
|
19
|
+
[`opteryx-sqlalchemy`](https://pypi.org/project/opteryx-sqlalchemy/).
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install dbt-opteryx
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Profile
|
|
28
|
+
|
|
29
|
+
dbt's `database` is an Opteryx **workspace** and `schema` is a **collection**
|
|
30
|
+
(`workspace` / `collection` are accepted as aliases). Every account has a personal
|
|
31
|
+
space, `personal.<your user>`, which needs no setup:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
my_project:
|
|
35
|
+
target: cloud
|
|
36
|
+
outputs:
|
|
37
|
+
cloud:
|
|
38
|
+
type: opteryx
|
|
39
|
+
host: opteryx.app
|
|
40
|
+
port: 443
|
|
41
|
+
ssl: true
|
|
42
|
+
user: "{{ env_var('OPTERYX_USER') }}"
|
|
43
|
+
token: "{{ env_var('OPTERYX_TOKEN') }}"
|
|
44
|
+
database: personal # workspace
|
|
45
|
+
schema: "{{ env_var('OPTERYX_USER') }}" # collection
|
|
46
|
+
threads: 1
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Put this in `dbt_project.yml` until the leading-comment issue below is fixed:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
query-comment:
|
|
53
|
+
append: true
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Behaviour to know about
|
|
57
|
+
|
|
58
|
+
- **No transactions.** Opteryx has none; every statement commits on its own. The
|
|
59
|
+
adapter sends nothing for dbt's BEGIN/COMMIT.
|
|
60
|
+
- **No temporary tables.** dbt's `__dbt_tmp` intermediates are real tables, which
|
|
61
|
+
dbt drops when the model succeeds. A failed model can leave one behind.
|
|
62
|
+
- **Views** are built with `CREATE OR REPLACE VIEW`, not dbt's rename swap.
|
|
63
|
+
- **Seeds** are inserted as typed literals (`CAST('…' AS <type>)`), not bind
|
|
64
|
+
parameters: parameters reach Opteryx as JSON, which has no DATE or TIMESTAMP.
|
|
65
|
+
- **Incremental strategies:** `append`, `merge` and `delete+insert`.
|
|
66
|
+
- **Model contracts are refused**, with an error naming the model: the adapter does
|
|
67
|
+
not enforce them yet, and ignoring one silently would claim a guarantee it does not keep.
|
|
68
|
+
- **Queries cannot be cancelled** from dbt.
|
|
69
|
+
|
|
70
|
+
## Integration tests
|
|
71
|
+
|
|
72
|
+
`tests/integration/project` is a dbt project covering seeds, sources (including
|
|
73
|
+
freshness), view, table, ephemeral and incremental models (all three strategies),
|
|
74
|
+
snapshots, hooks, contracts, generic, singular and unit tests, `show`,
|
|
75
|
+
`run-operation`, `--empty` and docs generation. Run it against opteryx.app:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
CLIENT_ID=… CLIENT_SECRET=… python tests/integration/run.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Every step runs, and every node must pass except those listed in
|
|
82
|
+
`EXPECTED_FAILURES` in `run.py`, which must fail. The run fails on an unexpected
|
|
83
|
+
failure and also on an expected failure that passes, so the list is pruned as
|
|
84
|
+
Opteryx gaps close.
|
|
85
|
+
|
|
86
|
+
It writes into `personal.$CLIENT_ID` (override with `OPTERYX_WORKSPACE` /
|
|
87
|
+
`OPTERYX_COLLECTION`). CI runs it on push (`.github/workflows/integration.yaml`),
|
|
88
|
+
reading `CLIENT_ID` / `CLIENT_SECRET` from the `OPTERYX_TEST_CLIENT` /
|
|
89
|
+
`OPTERYX_TEST_TOKEN` repository secrets. That is a service account, which has no
|
|
90
|
+
personal space, so CI writes into `opteryx_ci.dbt`.
|
|
91
|
+
|
|
92
|
+
Offline checks (no connection) run with `python -m pytest tests/unit`.
|
|
93
|
+
|
|
94
|
+
## CI
|
|
95
|
+
|
|
96
|
+
| Workflow | Runs on | Does |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `regression-tests.yaml` | push | `tests/unit` on Python 3.10–3.14 × dbt-core 1.10 (floor) and latest; 1.10 is skipped on 3.14, where it cannot import |
|
|
99
|
+
| `integration.yaml` | push | `tests/integration/run.py` against opteryx.app; known gaps are expected failures |
|
|
100
|
+
| `semgrep_scan.yaml` | push | Semgrep scan, findings uploaded to `opteryx.ops.sast_findings` |
|
|
101
|
+
| `release.yaml` | `v*` tag | Builds and publishes to PyPI by trusted publishing |
|
|
102
|
+
|
|
103
|
+
Repository secrets: `OPTERYX_TEST_CLIENT`, `OPTERYX_TEST_TOKEN` (integration),
|
|
104
|
+
`UPLOAD_CLIENT`, `UPLOAD_TOKEN` (Semgrep upload).
|
|
105
|
+
|
|
106
|
+
## Releasing
|
|
107
|
+
|
|
108
|
+
Bump `version` in `dbt/adapters/opteryx/__version__.py` (the package version is read
|
|
109
|
+
from it), then push a matching `vX.Y.Z` tag. PyPI must list this repository's
|
|
110
|
+
`release.yaml` as a trusted publisher for `dbt-opteryx`; for the first release that
|
|
111
|
+
is a pending publisher, set up on PyPI before the tag is pushed.
|
|
112
|
+
|
|
113
|
+
## Verification against opteryx.app (2026-11-09)
|
|
114
|
+
|
|
115
|
+
dbt-core 1.12.6, dbt-adapters 1.24.5, opteryx-sqlalchemy 0.0.13.
|
|
116
|
+
|
|
117
|
+
| Feature | Result | Notes |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `dbt debug` | PASS | |
|
|
120
|
+
| Seeds, first load | PASS | Needs the typed-literal loader in this adapter |
|
|
121
|
+
| Seeds, reload over an existing table | **FAIL (silent)** | Reports OK but doubles the rows: TRUNCATE is a no-op (issue 1) |
|
|
122
|
+
| Seeds, `--full-refresh` | PASS | Drops and recreates |
|
|
123
|
+
| Sources: `source()` reads | PASS | `samples.tpch_sf001.nation` |
|
|
124
|
+
| Sources: tests | PASS | not_null, unique |
|
|
125
|
+
| Sources: `dbt source freshness` | PASS | |
|
|
126
|
+
| View materialization | PASS | Created and replaced |
|
|
127
|
+
| Table materialization | PASS | Created; rebuilt through the rename swap |
|
|
128
|
+
| Incremental, `append` | PASS | Second run appends only new rows (checked 4 → 5) |
|
|
129
|
+
| Incremental, `merge`, first build | PASS | |
|
|
130
|
+
| Incremental, `merge`, incremental run | **FAIL** | Issue 3 |
|
|
131
|
+
| Tests: not_null, unique, singular | PASS | |
|
|
132
|
+
| Tests: accepted_values, relationships | **FAIL** | Issue 4 |
|
|
133
|
+
| `dbt docs generate` | PARTIAL | Catalog written; views have no columns (issue 5) |
|
|
134
|
+
| Schema creation (`CREATE COLLECTION`) | PASS with workaround | Issue 2 |
|
|
135
|
+
| Incremental, `delete+insert`, first build | PASS | |
|
|
136
|
+
| Incremental, `delete+insert`, incremental run | **FAIL** | Issues 11 and 12 |
|
|
137
|
+
| Ephemeral models | **FAIL** | Issue 13 |
|
|
138
|
+
| Snapshots (timestamp and check strategies) | **FAIL** | Issue 14; would then hit issue 3 |
|
|
139
|
+
| Unit tests | **FAIL** | Issue 5: fixtures need the input view's columns |
|
|
140
|
+
| `--empty` | **FAIL** | Issue 15 |
|
|
141
|
+
| Model contracts | **Refused** | The adapter raises (see above) |
|
|
142
|
+
| Pre/post hooks | PASS | Hook statements ran, checked in `hook_log` |
|
|
143
|
+
| `dbt show` | PASS | |
|
|
144
|
+
| `dbt run-operation` with `run_query` | PASS | |
|
|
145
|
+
|
|
146
|
+
## Issues found
|
|
147
|
+
|
|
148
|
+
| # | Issue | Class | Proposed fix |
|
|
149
|
+
|---|---|---|---|
|
|
150
|
+
| 1 | `TRUNCATE TABLE` reports OK and removes nothing. `OpteryxConnector.truncate_relation` calls `Dataset.truncate()`, whose default `commit_truncation=False` never moves `current-snapshot-id`. | Opteryx correctness bug | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the connector now passes `commit_truncation=True`. Re-run the matrix after deploy. |
|
|
151
|
+
| 2 | `CREATE/DROP COLLECTION` and `ALTER/DROP WORKSPACE` fail to parse after a leading comment. dbt puts a comment in front of every statement. | Opteryx SQL gap | Have the `^\s*` anchors in `opteryx/planner/sql_rewriter/__init__.py:240-251` skip leading comments. Docs workaround: `query-comment: {append: true}`. |
|
|
152
|
+
| 3 | `MERGE … WHEN NOT MATCHED THEN INSERT (…) VALUES ("id", …)` raises "Column id is ambiguous". Only the source is in scope there; qualified `S."id"` works. | Opteryx SQL gap | Bind WHEN NOT MATCHED value expressions against the source relation only. |
|
|
153
|
+
| 4 | A CTE inside a derived table is not found: `SELECT … FROM (WITH a AS (…) SELECT * FROM a) t` gives "Dataset `a` cannot be found". dbt wraps every test in such a subquery. | Opteryx SQL gap | Scope CTEs declared inside a subquery to that subquery. |
|
|
154
|
+
| 5 | `information_schema.columns` has no rows for views, so dbt cannot see view columns. | Opteryx SQL gap | List view columns there as well; it currently iterates `list_datasets()` only. |
|
|
155
|
+
| 6 | `personal.information_schema.schemata` is empty although `personal.<user>` exists. dbt then always issues `CREATE COLLECTION IF NOT EXISTS`, which succeeds. | Opteryx catalog gap (not blocking) | List the caller's personal collection. |
|
|
156
|
+
| 7 | CAST refuses `DOUBLE`, `BIGINT` and `TEXT` ("not a type CAST can produce") although `reference/types.json` lists them as accepted spellings. dbt's default seed types are `text` / `float8`. | Opteryx SQL gap | Accept the listed spellings in CAST. The adapter maps seed types itself meanwhile. |
|
|
157
|
+
| 8 | INSERT type errors print the enum repr, e.g. "target LogicalCategory.FLOAT". | Opteryx message bug | Render the type name. |
|
|
158
|
+
| 9 | Bind parameters of type `Decimal`, `date` or `datetime` fail with "not JSON serializable" in the DBAPI. | Adapter/protocol gap (opteryx-sqlalchemy) | Encode them in `_submit_statement`. Even then, the server will not coerce a string into DATE/TIMESTAMP, so this adapter's seeds use literals. |
|
|
159
|
+
| 10 | `ALTER TABLE x RENAME TO y` with a bare target is read as a move to another workspace. | Behaviour (documented) | None needed: the adapter always passes the qualified name. |
|
|
160
|
+
| 11 | `WHERE (id) IN (SELECT …)` with one parenthesised column fails: "A correlated EXISTS/IN subquery correlates on `(id)`…". Without the parentheses it works. dbt's delete+insert always parenthesises. | Opteryx SQL gap | Treat a one-element parenthesised expression as the expression itself. |
|
|
161
|
+
| 12 | **INSERT fails after a DELETE that removed every row** of the table's files: "concat: all inputs must share one type for 'column_uncompressed_sizes_in_bytes' - found INT64, ARRAY". Root cause is in rugo: a zero-row `array<…>` column reads back as INT64. The delete-all writes a manifest with one zero-row row group, INSERT appends a row group to it, and `read_manifest_columns` cannot combine the two. Three-line reproducer: write an empty ARRAY vector with `rugo.parquet.write_parquet`; `read_parquet` returns it as INT64. Not dbt-specific. | Opteryx correctness bug (rugo reader) | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the reader routes list columns on the schema's `max_rep_level`, not on whether repetition levels were decoded. Manifests already written this way need no rewrite; they read correctly once the fix is deployed. |
|
|
162
|
+
| 13 | `CREATE TABLE … AS WITH a AS (…) SELECT … FROM a` gives "Dataset `a` cannot be found". The same query without CREATE works. dbt inlines ephemeral models this way. | Opteryx SQL gap | Resolve CTEs in a CTAS body. |
|
|
163
|
+
| 14 | `SELECT *, x` is refused by design ("`SELECT *` cannot coexist with additional columns"); `SELECT t.*, x` works. dbt's snapshot SQL uses `SELECT *, …`. | Opteryx dialect rule | Either allow `*` with other columns, or override dbt's snapshot macros in the adapter to qualify the star. Architect's call. |
|
|
164
|
+
| 15 | `WHERE false` is refused by design ("WHERE clause cannot be a bare literal"); `WHERE 1 = 0` works. dbt's `--empty` renders refs as `(SELECT * FROM x WHERE false LIMIT 0)`, and contract enforcement uses the same pattern. | Opteryx dialect rule | Either accept a bare boolean literal, or override the relation's limited render in the adapter. Architect's call. |
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# dbt-opteryx
|
|
2
|
+
|
|
3
|
+
dbt adapter for [Opteryx Cloud](https://opteryx.app). It runs dbt Core 1.x against
|
|
4
|
+
Opteryx's HTTP jobs API, using the DBAPI from
|
|
5
|
+
[`opteryx-sqlalchemy`](https://pypi.org/project/opteryx-sqlalchemy/).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install dbt-opteryx
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Profile
|
|
14
|
+
|
|
15
|
+
dbt's `database` is an Opteryx **workspace** and `schema` is a **collection**
|
|
16
|
+
(`workspace` / `collection` are accepted as aliases). Every account has a personal
|
|
17
|
+
space, `personal.<your user>`, which needs no setup:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
my_project:
|
|
21
|
+
target: cloud
|
|
22
|
+
outputs:
|
|
23
|
+
cloud:
|
|
24
|
+
type: opteryx
|
|
25
|
+
host: opteryx.app
|
|
26
|
+
port: 443
|
|
27
|
+
ssl: true
|
|
28
|
+
user: "{{ env_var('OPTERYX_USER') }}"
|
|
29
|
+
token: "{{ env_var('OPTERYX_TOKEN') }}"
|
|
30
|
+
database: personal # workspace
|
|
31
|
+
schema: "{{ env_var('OPTERYX_USER') }}" # collection
|
|
32
|
+
threads: 1
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Put this in `dbt_project.yml` until the leading-comment issue below is fixed:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
query-comment:
|
|
39
|
+
append: true
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Behaviour to know about
|
|
43
|
+
|
|
44
|
+
- **No transactions.** Opteryx has none; every statement commits on its own. The
|
|
45
|
+
adapter sends nothing for dbt's BEGIN/COMMIT.
|
|
46
|
+
- **No temporary tables.** dbt's `__dbt_tmp` intermediates are real tables, which
|
|
47
|
+
dbt drops when the model succeeds. A failed model can leave one behind.
|
|
48
|
+
- **Views** are built with `CREATE OR REPLACE VIEW`, not dbt's rename swap.
|
|
49
|
+
- **Seeds** are inserted as typed literals (`CAST('…' AS <type>)`), not bind
|
|
50
|
+
parameters: parameters reach Opteryx as JSON, which has no DATE or TIMESTAMP.
|
|
51
|
+
- **Incremental strategies:** `append`, `merge` and `delete+insert`.
|
|
52
|
+
- **Model contracts are refused**, with an error naming the model: the adapter does
|
|
53
|
+
not enforce them yet, and ignoring one silently would claim a guarantee it does not keep.
|
|
54
|
+
- **Queries cannot be cancelled** from dbt.
|
|
55
|
+
|
|
56
|
+
## Integration tests
|
|
57
|
+
|
|
58
|
+
`tests/integration/project` is a dbt project covering seeds, sources (including
|
|
59
|
+
freshness), view, table, ephemeral and incremental models (all three strategies),
|
|
60
|
+
snapshots, hooks, contracts, generic, singular and unit tests, `show`,
|
|
61
|
+
`run-operation`, `--empty` and docs generation. Run it against opteryx.app:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
CLIENT_ID=… CLIENT_SECRET=… python tests/integration/run.py
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Every step runs, and every node must pass except those listed in
|
|
68
|
+
`EXPECTED_FAILURES` in `run.py`, which must fail. The run fails on an unexpected
|
|
69
|
+
failure and also on an expected failure that passes, so the list is pruned as
|
|
70
|
+
Opteryx gaps close.
|
|
71
|
+
|
|
72
|
+
It writes into `personal.$CLIENT_ID` (override with `OPTERYX_WORKSPACE` /
|
|
73
|
+
`OPTERYX_COLLECTION`). CI runs it on push (`.github/workflows/integration.yaml`),
|
|
74
|
+
reading `CLIENT_ID` / `CLIENT_SECRET` from the `OPTERYX_TEST_CLIENT` /
|
|
75
|
+
`OPTERYX_TEST_TOKEN` repository secrets. That is a service account, which has no
|
|
76
|
+
personal space, so CI writes into `opteryx_ci.dbt`.
|
|
77
|
+
|
|
78
|
+
Offline checks (no connection) run with `python -m pytest tests/unit`.
|
|
79
|
+
|
|
80
|
+
## CI
|
|
81
|
+
|
|
82
|
+
| Workflow | Runs on | Does |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `regression-tests.yaml` | push | `tests/unit` on Python 3.10–3.14 × dbt-core 1.10 (floor) and latest; 1.10 is skipped on 3.14, where it cannot import |
|
|
85
|
+
| `integration.yaml` | push | `tests/integration/run.py` against opteryx.app; known gaps are expected failures |
|
|
86
|
+
| `semgrep_scan.yaml` | push | Semgrep scan, findings uploaded to `opteryx.ops.sast_findings` |
|
|
87
|
+
| `release.yaml` | `v*` tag | Builds and publishes to PyPI by trusted publishing |
|
|
88
|
+
|
|
89
|
+
Repository secrets: `OPTERYX_TEST_CLIENT`, `OPTERYX_TEST_TOKEN` (integration),
|
|
90
|
+
`UPLOAD_CLIENT`, `UPLOAD_TOKEN` (Semgrep upload).
|
|
91
|
+
|
|
92
|
+
## Releasing
|
|
93
|
+
|
|
94
|
+
Bump `version` in `dbt/adapters/opteryx/__version__.py` (the package version is read
|
|
95
|
+
from it), then push a matching `vX.Y.Z` tag. PyPI must list this repository's
|
|
96
|
+
`release.yaml` as a trusted publisher for `dbt-opteryx`; for the first release that
|
|
97
|
+
is a pending publisher, set up on PyPI before the tag is pushed.
|
|
98
|
+
|
|
99
|
+
## Verification against opteryx.app (2026-11-09)
|
|
100
|
+
|
|
101
|
+
dbt-core 1.12.6, dbt-adapters 1.24.5, opteryx-sqlalchemy 0.0.13.
|
|
102
|
+
|
|
103
|
+
| Feature | Result | Notes |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `dbt debug` | PASS | |
|
|
106
|
+
| Seeds, first load | PASS | Needs the typed-literal loader in this adapter |
|
|
107
|
+
| Seeds, reload over an existing table | **FAIL (silent)** | Reports OK but doubles the rows: TRUNCATE is a no-op (issue 1) |
|
|
108
|
+
| Seeds, `--full-refresh` | PASS | Drops and recreates |
|
|
109
|
+
| Sources: `source()` reads | PASS | `samples.tpch_sf001.nation` |
|
|
110
|
+
| Sources: tests | PASS | not_null, unique |
|
|
111
|
+
| Sources: `dbt source freshness` | PASS | |
|
|
112
|
+
| View materialization | PASS | Created and replaced |
|
|
113
|
+
| Table materialization | PASS | Created; rebuilt through the rename swap |
|
|
114
|
+
| Incremental, `append` | PASS | Second run appends only new rows (checked 4 → 5) |
|
|
115
|
+
| Incremental, `merge`, first build | PASS | |
|
|
116
|
+
| Incremental, `merge`, incremental run | **FAIL** | Issue 3 |
|
|
117
|
+
| Tests: not_null, unique, singular | PASS | |
|
|
118
|
+
| Tests: accepted_values, relationships | **FAIL** | Issue 4 |
|
|
119
|
+
| `dbt docs generate` | PARTIAL | Catalog written; views have no columns (issue 5) |
|
|
120
|
+
| Schema creation (`CREATE COLLECTION`) | PASS with workaround | Issue 2 |
|
|
121
|
+
| Incremental, `delete+insert`, first build | PASS | |
|
|
122
|
+
| Incremental, `delete+insert`, incremental run | **FAIL** | Issues 11 and 12 |
|
|
123
|
+
| Ephemeral models | **FAIL** | Issue 13 |
|
|
124
|
+
| Snapshots (timestamp and check strategies) | **FAIL** | Issue 14; would then hit issue 3 |
|
|
125
|
+
| Unit tests | **FAIL** | Issue 5: fixtures need the input view's columns |
|
|
126
|
+
| `--empty` | **FAIL** | Issue 15 |
|
|
127
|
+
| Model contracts | **Refused** | The adapter raises (see above) |
|
|
128
|
+
| Pre/post hooks | PASS | Hook statements ran, checked in `hook_log` |
|
|
129
|
+
| `dbt show` | PASS | |
|
|
130
|
+
| `dbt run-operation` with `run_query` | PASS | |
|
|
131
|
+
|
|
132
|
+
## Issues found
|
|
133
|
+
|
|
134
|
+
| # | Issue | Class | Proposed fix |
|
|
135
|
+
|---|---|---|---|
|
|
136
|
+
| 1 | `TRUNCATE TABLE` reports OK and removes nothing. `OpteryxConnector.truncate_relation` calls `Dataset.truncate()`, whose default `commit_truncation=False` never moves `current-snapshot-id`. | Opteryx correctness bug | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the connector now passes `commit_truncation=True`. Re-run the matrix after deploy. |
|
|
137
|
+
| 2 | `CREATE/DROP COLLECTION` and `ALTER/DROP WORKSPACE` fail to parse after a leading comment. dbt puts a comment in front of every statement. | Opteryx SQL gap | Have the `^\s*` anchors in `opteryx/planner/sql_rewriter/__init__.py:240-251` skip leading comments. Docs workaround: `query-comment: {append: true}`. |
|
|
138
|
+
| 3 | `MERGE … WHEN NOT MATCHED THEN INSERT (…) VALUES ("id", …)` raises "Column id is ambiguous". Only the source is in scope there; qualified `S."id"` works. | Opteryx SQL gap | Bind WHEN NOT MATCHED value expressions against the source relation only. |
|
|
139
|
+
| 4 | A CTE inside a derived table is not found: `SELECT … FROM (WITH a AS (…) SELECT * FROM a) t` gives "Dataset `a` cannot be found". dbt wraps every test in such a subquery. | Opteryx SQL gap | Scope CTEs declared inside a subquery to that subquery. |
|
|
140
|
+
| 5 | `information_schema.columns` has no rows for views, so dbt cannot see view columns. | Opteryx SQL gap | List view columns there as well; it currently iterates `list_datasets()` only. |
|
|
141
|
+
| 6 | `personal.information_schema.schemata` is empty although `personal.<user>` exists. dbt then always issues `CREATE COLLECTION IF NOT EXISTS`, which succeeds. | Opteryx catalog gap (not blocking) | List the caller's personal collection. |
|
|
142
|
+
| 7 | CAST refuses `DOUBLE`, `BIGINT` and `TEXT` ("not a type CAST can produce") although `reference/types.json` lists them as accepted spellings. dbt's default seed types are `text` / `float8`. | Opteryx SQL gap | Accept the listed spellings in CAST. The adapter maps seed types itself meanwhile. |
|
|
143
|
+
| 8 | INSERT type errors print the enum repr, e.g. "target LogicalCategory.FLOAT". | Opteryx message bug | Render the type name. |
|
|
144
|
+
| 9 | Bind parameters of type `Decimal`, `date` or `datetime` fail with "not JSON serializable" in the DBAPI. | Adapter/protocol gap (opteryx-sqlalchemy) | Encode them in `_submit_statement`. Even then, the server will not coerce a string into DATE/TIMESTAMP, so this adapter's seeds use literals. |
|
|
145
|
+
| 10 | `ALTER TABLE x RENAME TO y` with a bare target is read as a move to another workspace. | Behaviour (documented) | None needed: the adapter always passes the qualified name. |
|
|
146
|
+
| 11 | `WHERE (id) IN (SELECT …)` with one parenthesised column fails: "A correlated EXISTS/IN subquery correlates on `(id)`…". Without the parentheses it works. dbt's delete+insert always parenthesises. | Opteryx SQL gap | Treat a one-element parenthesised expression as the expression itself. |
|
|
147
|
+
| 12 | **INSERT fails after a DELETE that removed every row** of the table's files: "concat: all inputs must share one type for 'column_uncompressed_sizes_in_bytes' - found INT64, ARRAY". Root cause is in rugo: a zero-row `array<…>` column reads back as INT64. The delete-all writes a manifest with one zero-row row group, INSERT appends a row group to it, and `read_manifest_columns` cannot combine the two. Three-line reproducer: write an empty ARRAY vector with `rugo.parquet.write_parquet`; `read_parquet` returns it as INT64. Not dbt-specific. | Opteryx correctness bug (rugo reader) | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the reader routes list columns on the schema's `max_rep_level`, not on whether repetition levels were decoded. Manifests already written this way need no rewrite; they read correctly once the fix is deployed. |
|
|
148
|
+
| 13 | `CREATE TABLE … AS WITH a AS (…) SELECT … FROM a` gives "Dataset `a` cannot be found". The same query without CREATE works. dbt inlines ephemeral models this way. | Opteryx SQL gap | Resolve CTEs in a CTAS body. |
|
|
149
|
+
| 14 | `SELECT *, x` is refused by design ("`SELECT *` cannot coexist with additional columns"); `SELECT t.*, x` works. dbt's snapshot SQL uses `SELECT *, …`. | Opteryx dialect rule | Either allow `*` with other columns, or override dbt's snapshot macros in the adapter to qualify the star. Architect's call. |
|
|
150
|
+
| 15 | `WHERE false` is refused by design ("WHERE clause cannot be a bare literal"); `WHERE 1 = 0` works. dbt's `--empty` renders refs as `(SELECT * FROM x WHERE false LIMIT 0)`, and contract enforcement uses the same pattern. | Opteryx dialect rule | Either accept a bare boolean literal, or override the relation's limited render in the adapter. Architect's call. |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from dbt.adapters.base import AdapterPlugin
|
|
2
|
+
|
|
3
|
+
from dbt.adapters.opteryx.connections import OpteryxConnectionManager # noqa: F401
|
|
4
|
+
from dbt.adapters.opteryx.connections import OpteryxCredentials
|
|
5
|
+
from dbt.adapters.opteryx.impl import OpteryxAdapter
|
|
6
|
+
from dbt.include import opteryx
|
|
7
|
+
|
|
8
|
+
Plugin = AdapterPlugin(
|
|
9
|
+
adapter=OpteryxAdapter,
|
|
10
|
+
credentials=OpteryxCredentials,
|
|
11
|
+
include_path=opteryx.PACKAGE_PATH,
|
|
12
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.1.0"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing import Tuple
|
|
5
|
+
|
|
6
|
+
from dbt.adapters.contracts.connection import AdapterResponse
|
|
7
|
+
from dbt.adapters.contracts.connection import Connection
|
|
8
|
+
from dbt.adapters.contracts.connection import Credentials
|
|
9
|
+
from dbt.adapters.sql import SQLConnectionManager
|
|
10
|
+
from dbt_common.exceptions import DbtDatabaseError
|
|
11
|
+
from sqlalchemy_dialect import dbapi
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class OpteryxCredentials(Credentials):
|
|
16
|
+
# database = Opteryx workspace, schema = collection
|
|
17
|
+
host: str = "opteryx.app"
|
|
18
|
+
port: int = 443
|
|
19
|
+
ssl: bool = True
|
|
20
|
+
user: Optional[str] = None
|
|
21
|
+
token: Optional[str] = None
|
|
22
|
+
timeout: float = 300.0
|
|
23
|
+
|
|
24
|
+
_ALIASES = {"workspace": "database", "collection": "schema"}
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def type(self) -> str:
|
|
28
|
+
return "opteryx"
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def unique_field(self) -> str:
|
|
32
|
+
return self.host
|
|
33
|
+
|
|
34
|
+
def _connection_keys(self) -> Tuple[str, ...]:
|
|
35
|
+
return ("host", "port", "ssl", "user", "database", "schema", "timeout")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class OpteryxConnectionManager(SQLConnectionManager):
|
|
39
|
+
TYPE = "opteryx"
|
|
40
|
+
|
|
41
|
+
@contextmanager
|
|
42
|
+
def exception_handler(self, sql: str):
|
|
43
|
+
try:
|
|
44
|
+
yield
|
|
45
|
+
except dbapi.Error as e:
|
|
46
|
+
raise DbtDatabaseError(str(e)) from e
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def open(cls, connection: Connection) -> Connection:
|
|
50
|
+
if connection.state == "open":
|
|
51
|
+
return connection
|
|
52
|
+
creds = connection.credentials
|
|
53
|
+
connection.handle = dbapi.connect(
|
|
54
|
+
host=creds.host,
|
|
55
|
+
port=creds.port,
|
|
56
|
+
username=creds.user,
|
|
57
|
+
token=creds.token,
|
|
58
|
+
ssl=creds.ssl,
|
|
59
|
+
timeout=creds.timeout,
|
|
60
|
+
)
|
|
61
|
+
connection.state = "open"
|
|
62
|
+
return connection
|
|
63
|
+
|
|
64
|
+
def cancel(self, connection: Connection) -> None:
|
|
65
|
+
# OpteryxAdapter.is_cancelable() is False, so dbt never calls this.
|
|
66
|
+
raise NotImplementedError("dbt-opteryx does not cancel in-flight queries")
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def get_response(cls, cursor) -> AdapterResponse:
|
|
70
|
+
return AdapterResponse(
|
|
71
|
+
_message="OK", rows_affected=cursor.rowcount, query_id=cursor.statement_handle
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Opteryx has no transactions: every statement commits on its own. dbt still
|
|
75
|
+
# brackets work in begin/commit, so these send nothing to the server.
|
|
76
|
+
def add_begin_query(self):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
def add_commit_query(self):
|
|
80
|
+
pass
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from dbt.adapters.sql import SQLAdapter
|
|
2
|
+
|
|
3
|
+
from dbt.adapters.opteryx.connections import OpteryxConnectionManager
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OpteryxAdapter(SQLAdapter):
|
|
7
|
+
ConnectionManager = OpteryxConnectionManager
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def date_function(cls) -> str:
|
|
11
|
+
return "now()"
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def is_cancelable(cls) -> bool:
|
|
15
|
+
return False
|
|
16
|
+
|
|
17
|
+
def valid_incremental_strategies(self):
|
|
18
|
+
return ["append", "merge", "delete+insert"]
|
|
19
|
+
|
|
20
|
+
# Seed column types. Opteryx CAST refuses dbt's defaults (`text`, `float8`).
|
|
21
|
+
@classmethod
|
|
22
|
+
def convert_text_type(cls, agate_table, col_idx) -> str:
|
|
23
|
+
return "VARCHAR"
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def convert_number_type(cls, agate_table, col_idx) -> str:
|
|
27
|
+
import agate # dbt imports agate lazily; follow suit
|
|
28
|
+
|
|
29
|
+
decimals = agate_table.aggregate(agate.MaxPrecision(col_idx))
|
|
30
|
+
return "FLOAT" if decimals else "INTEGER"
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def convert_integer_type(cls, agate_table, col_idx) -> str:
|
|
34
|
+
return "INTEGER"
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def convert_boolean_type(cls, agate_table, col_idx) -> str:
|
|
38
|
+
return "BOOLEAN"
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def convert_datetime_type(cls, agate_table, col_idx) -> str:
|
|
42
|
+
return "TIMESTAMP"
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def convert_date_type(cls, agate_table, col_idx) -> str:
|
|
46
|
+
return "DATE"
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def convert_time_type(cls, agate_table, col_idx) -> str:
|
|
50
|
+
return "TIME"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{# database = workspace, schema = collection, identifier = dataset #}
|
|
2
|
+
|
|
3
|
+
{% macro opteryx__get_binding_char() %}?{% endmacro %}
|
|
4
|
+
|
|
5
|
+
{% macro opteryx__current_timestamp() %}now(){% endmacro %}
|
|
6
|
+
|
|
7
|
+
{% macro opteryx__create_schema(relation) -%}
|
|
8
|
+
{% call statement('create_schema') -%}
|
|
9
|
+
CREATE COLLECTION IF NOT EXISTS {{ relation.without_identifier() }}
|
|
10
|
+
{%- endcall %}
|
|
11
|
+
{% endmacro %}
|
|
12
|
+
|
|
13
|
+
{% macro opteryx__list_schemas(database) -%}
|
|
14
|
+
{% call statement('list_schemas', fetch_result=True, auto_begin=False) %}
|
|
15
|
+
SELECT schema_name FROM {{ database }}.information_schema.schemata
|
|
16
|
+
{% endcall %}
|
|
17
|
+
{{ return(load_result('list_schemas').table) }}
|
|
18
|
+
{% endmacro %}
|
|
19
|
+
|
|
20
|
+
{% macro opteryx__check_schema_exists(information_schema, schema) -%}
|
|
21
|
+
{% call statement('check_schema_exists', fetch_result=True, auto_begin=False) -%}
|
|
22
|
+
SELECT COUNT(*) FROM {{ information_schema.database }}.information_schema.schemata
|
|
23
|
+
WHERE schema_name = '{{ schema }}'
|
|
24
|
+
{%- endcall %}
|
|
25
|
+
{{ return(load_result('check_schema_exists').table) }}
|
|
26
|
+
{% endmacro %}
|
|
27
|
+
|
|
28
|
+
{% macro opteryx__list_relations_without_caching(schema_relation) %}
|
|
29
|
+
{% call statement('list_relations_without_caching', fetch_result=True) -%}
|
|
30
|
+
SELECT
|
|
31
|
+
table_catalog AS database,
|
|
32
|
+
table_name AS name,
|
|
33
|
+
table_schema AS schema,
|
|
34
|
+
CASE WHEN table_type = 'VIEW' THEN 'view' ELSE 'table' END AS type
|
|
35
|
+
FROM {{ schema_relation.database }}.information_schema.tables
|
|
36
|
+
WHERE table_schema = '{{ schema_relation.schema }}'
|
|
37
|
+
{%- endcall %}
|
|
38
|
+
{{ return(load_result('list_relations_without_caching').table) }}
|
|
39
|
+
{% endmacro %}
|
|
40
|
+
|
|
41
|
+
{% macro opteryx__get_columns_in_relation(relation) -%}
|
|
42
|
+
{% call statement('get_columns_in_relation', fetch_result=True) %}
|
|
43
|
+
SELECT
|
|
44
|
+
column_name,
|
|
45
|
+
data_type,
|
|
46
|
+
NULL AS character_maximum_length,
|
|
47
|
+
NULL AS numeric_precision,
|
|
48
|
+
NULL AS numeric_scale
|
|
49
|
+
FROM {{ relation.database }}.information_schema.columns
|
|
50
|
+
WHERE table_schema = '{{ relation.schema }}'
|
|
51
|
+
AND table_name = '{{ relation.identifier }}'
|
|
52
|
+
ORDER BY ordinal_position
|
|
53
|
+
{% endcall %}
|
|
54
|
+
{% set table = load_result('get_columns_in_relation').table %}
|
|
55
|
+
{{ return(sql_convert_columns_in_relation(table)) }}
|
|
56
|
+
{% endmacro %}
|
|
57
|
+
|
|
58
|
+
{% macro opteryx__create_table_as(temporary, relation, sql) -%}
|
|
59
|
+
{#- Opteryx has no temporary tables; dbt drops its intermediates itself. -#}
|
|
60
|
+
{%- if config.get('contract').enforced -%}
|
|
61
|
+
{{ exceptions.raise_compiler_error("dbt-opteryx does not enforce model contracts; remove `contract: {enforced: true}` from " ~ relation) }}
|
|
62
|
+
{%- endif -%}
|
|
63
|
+
CREATE TABLE {{ relation }} AS {{ sql }}
|
|
64
|
+
{%- endmacro %}
|
|
65
|
+
|
|
66
|
+
{% macro opteryx__create_view_as(relation, sql) -%}
|
|
67
|
+
CREATE OR REPLACE VIEW {{ relation }} AS {{ sql }}
|
|
68
|
+
{%- endmacro %}
|
|
69
|
+
|
|
70
|
+
{% macro opteryx__drop_relation(relation) -%}
|
|
71
|
+
{% call statement('drop_relation', auto_begin=False) -%}
|
|
72
|
+
DROP {{ relation.type }} IF EXISTS {{ relation }}
|
|
73
|
+
{%- endcall %}
|
|
74
|
+
{% endmacro %}
|
|
75
|
+
|
|
76
|
+
{% macro opteryx__rename_relation(from_relation, to_relation) -%}
|
|
77
|
+
{#- Opteryx requires the fully qualified target name. -#}
|
|
78
|
+
{% call statement('rename_relation') -%}
|
|
79
|
+
ALTER {{ from_relation.type }} {{ from_relation }} RENAME TO {{ to_relation }}
|
|
80
|
+
{%- endcall %}
|
|
81
|
+
{% endmacro %}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{% macro opteryx__get_catalog(information_schema, schemas) -%}
|
|
2
|
+
{% set query %}
|
|
3
|
+
SELECT
|
|
4
|
+
t.table_catalog AS table_database,
|
|
5
|
+
t.table_schema AS table_schema,
|
|
6
|
+
t.table_name AS table_name,
|
|
7
|
+
CASE WHEN t.table_type = 'VIEW' THEN 'VIEW' ELSE 'BASE TABLE' END AS table_type,
|
|
8
|
+
NULL AS table_comment,
|
|
9
|
+
c.column_name AS column_name,
|
|
10
|
+
c.ordinal_position AS column_index,
|
|
11
|
+
c.data_type AS column_type,
|
|
12
|
+
NULL AS column_comment,
|
|
13
|
+
NULL AS table_owner
|
|
14
|
+
FROM {{ information_schema.database }}.information_schema.tables AS t
|
|
15
|
+
INNER JOIN {{ information_schema.database }}.information_schema.columns AS c
|
|
16
|
+
ON t.table_schema = c.table_schema AND t.table_name = c.table_name
|
|
17
|
+
WHERE t.table_schema IN (
|
|
18
|
+
{%- for schema in schemas -%}'{{ schema }}'{%- if not loop.last %}, {% endif -%}{%- endfor -%}
|
|
19
|
+
)
|
|
20
|
+
ORDER BY t.table_schema, t.table_name, c.ordinal_position
|
|
21
|
+
{% endset %}
|
|
22
|
+
{{ return(run_query(query)) }}
|
|
23
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Seed rows are rendered as typed literals, not bind parameters: parameters reach
|
|
3
|
+
Opteryx as JSON values, JSON has no DATE/TIMESTAMP, and INSERT will not coerce a
|
|
4
|
+
VARCHAR into a typed column.
|
|
5
|
+
-#}
|
|
6
|
+
{% macro opteryx__load_csv_rows(model, agate_table) %}
|
|
7
|
+
{% set column_override = model['config'].get('column_types', {}) %}
|
|
8
|
+
{% set types = [] %}
|
|
9
|
+
{% for col_name in agate_table.column_names %}
|
|
10
|
+
{% do types.append(column_override.get(col_name, adapter.convert_type(agate_table, loop.index0))) %}
|
|
11
|
+
{% endfor %}
|
|
12
|
+
{% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}
|
|
13
|
+
{% set statements = [] %}
|
|
14
|
+
|
|
15
|
+
{% for chunk in agate_table.rows | batch(get_batch_size()) %}
|
|
16
|
+
{% set sql %}
|
|
17
|
+
INSERT INTO {{ this.render() }} ({{ cols_sql }}) VALUES
|
|
18
|
+
{% for row in chunk -%}
|
|
19
|
+
({%- for value in row -%}
|
|
20
|
+
{%- if value is none -%}NULL{%- else -%}CAST('{{ (value | string) | replace("'", "''") }}' AS {{ types[loop.index0] }}){%- endif -%}
|
|
21
|
+
{%- if not loop.last %}, {% endif -%}
|
|
22
|
+
{%- endfor -%})
|
|
23
|
+
{%- if not loop.last %},{% endif %}
|
|
24
|
+
{% endfor %}
|
|
25
|
+
{% endset %}
|
|
26
|
+
{% do adapter.add_query(sql, abridge_sql_log=True) %}
|
|
27
|
+
{% if loop.index0 == 0 %}
|
|
28
|
+
{% do statements.append(sql) %}
|
|
29
|
+
{% endif %}
|
|
30
|
+
{% endfor %}
|
|
31
|
+
|
|
32
|
+
{{ return(statements[0]) }}
|
|
33
|
+
{% endmacro %}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dbt-opteryx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: dbt adapter for Opteryx Cloud (https://opteryx.app)
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: dbt-core<2,>=1.10
|
|
10
|
+
Requires-Dist: dbt-adapters<2,>=1.7
|
|
11
|
+
Requires-Dist: dbt-common<2,>=1.10
|
|
12
|
+
Requires-Dist: opteryx-sqlalchemy>=0.0.13
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# dbt-opteryx
|
|
16
|
+
|
|
17
|
+
dbt adapter for [Opteryx Cloud](https://opteryx.app). It runs dbt Core 1.x against
|
|
18
|
+
Opteryx's HTTP jobs API, using the DBAPI from
|
|
19
|
+
[`opteryx-sqlalchemy`](https://pypi.org/project/opteryx-sqlalchemy/).
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install dbt-opteryx
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Profile
|
|
28
|
+
|
|
29
|
+
dbt's `database` is an Opteryx **workspace** and `schema` is a **collection**
|
|
30
|
+
(`workspace` / `collection` are accepted as aliases). Every account has a personal
|
|
31
|
+
space, `personal.<your user>`, which needs no setup:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
my_project:
|
|
35
|
+
target: cloud
|
|
36
|
+
outputs:
|
|
37
|
+
cloud:
|
|
38
|
+
type: opteryx
|
|
39
|
+
host: opteryx.app
|
|
40
|
+
port: 443
|
|
41
|
+
ssl: true
|
|
42
|
+
user: "{{ env_var('OPTERYX_USER') }}"
|
|
43
|
+
token: "{{ env_var('OPTERYX_TOKEN') }}"
|
|
44
|
+
database: personal # workspace
|
|
45
|
+
schema: "{{ env_var('OPTERYX_USER') }}" # collection
|
|
46
|
+
threads: 1
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Put this in `dbt_project.yml` until the leading-comment issue below is fixed:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
query-comment:
|
|
53
|
+
append: true
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Behaviour to know about
|
|
57
|
+
|
|
58
|
+
- **No transactions.** Opteryx has none; every statement commits on its own. The
|
|
59
|
+
adapter sends nothing for dbt's BEGIN/COMMIT.
|
|
60
|
+
- **No temporary tables.** dbt's `__dbt_tmp` intermediates are real tables, which
|
|
61
|
+
dbt drops when the model succeeds. A failed model can leave one behind.
|
|
62
|
+
- **Views** are built with `CREATE OR REPLACE VIEW`, not dbt's rename swap.
|
|
63
|
+
- **Seeds** are inserted as typed literals (`CAST('…' AS <type>)`), not bind
|
|
64
|
+
parameters: parameters reach Opteryx as JSON, which has no DATE or TIMESTAMP.
|
|
65
|
+
- **Incremental strategies:** `append`, `merge` and `delete+insert`.
|
|
66
|
+
- **Model contracts are refused**, with an error naming the model: the adapter does
|
|
67
|
+
not enforce them yet, and ignoring one silently would claim a guarantee it does not keep.
|
|
68
|
+
- **Queries cannot be cancelled** from dbt.
|
|
69
|
+
|
|
70
|
+
## Integration tests
|
|
71
|
+
|
|
72
|
+
`tests/integration/project` is a dbt project covering seeds, sources (including
|
|
73
|
+
freshness), view, table, ephemeral and incremental models (all three strategies),
|
|
74
|
+
snapshots, hooks, contracts, generic, singular and unit tests, `show`,
|
|
75
|
+
`run-operation`, `--empty` and docs generation. Run it against opteryx.app:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
CLIENT_ID=… CLIENT_SECRET=… python tests/integration/run.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Every step runs, and every node must pass except those listed in
|
|
82
|
+
`EXPECTED_FAILURES` in `run.py`, which must fail. The run fails on an unexpected
|
|
83
|
+
failure and also on an expected failure that passes, so the list is pruned as
|
|
84
|
+
Opteryx gaps close.
|
|
85
|
+
|
|
86
|
+
It writes into `personal.$CLIENT_ID` (override with `OPTERYX_WORKSPACE` /
|
|
87
|
+
`OPTERYX_COLLECTION`). CI runs it on push (`.github/workflows/integration.yaml`),
|
|
88
|
+
reading `CLIENT_ID` / `CLIENT_SECRET` from the `OPTERYX_TEST_CLIENT` /
|
|
89
|
+
`OPTERYX_TEST_TOKEN` repository secrets. That is a service account, which has no
|
|
90
|
+
personal space, so CI writes into `opteryx_ci.dbt`.
|
|
91
|
+
|
|
92
|
+
Offline checks (no connection) run with `python -m pytest tests/unit`.
|
|
93
|
+
|
|
94
|
+
## CI
|
|
95
|
+
|
|
96
|
+
| Workflow | Runs on | Does |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `regression-tests.yaml` | push | `tests/unit` on Python 3.10–3.14 × dbt-core 1.10 (floor) and latest; 1.10 is skipped on 3.14, where it cannot import |
|
|
99
|
+
| `integration.yaml` | push | `tests/integration/run.py` against opteryx.app; known gaps are expected failures |
|
|
100
|
+
| `semgrep_scan.yaml` | push | Semgrep scan, findings uploaded to `opteryx.ops.sast_findings` |
|
|
101
|
+
| `release.yaml` | `v*` tag | Builds and publishes to PyPI by trusted publishing |
|
|
102
|
+
|
|
103
|
+
Repository secrets: `OPTERYX_TEST_CLIENT`, `OPTERYX_TEST_TOKEN` (integration),
|
|
104
|
+
`UPLOAD_CLIENT`, `UPLOAD_TOKEN` (Semgrep upload).
|
|
105
|
+
|
|
106
|
+
## Releasing
|
|
107
|
+
|
|
108
|
+
Bump `version` in `dbt/adapters/opteryx/__version__.py` (the package version is read
|
|
109
|
+
from it), then push a matching `vX.Y.Z` tag. PyPI must list this repository's
|
|
110
|
+
`release.yaml` as a trusted publisher for `dbt-opteryx`; for the first release that
|
|
111
|
+
is a pending publisher, set up on PyPI before the tag is pushed.
|
|
112
|
+
|
|
113
|
+
## Verification against opteryx.app (2026-11-09)
|
|
114
|
+
|
|
115
|
+
dbt-core 1.12.6, dbt-adapters 1.24.5, opteryx-sqlalchemy 0.0.13.
|
|
116
|
+
|
|
117
|
+
| Feature | Result | Notes |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `dbt debug` | PASS | |
|
|
120
|
+
| Seeds, first load | PASS | Needs the typed-literal loader in this adapter |
|
|
121
|
+
| Seeds, reload over an existing table | **FAIL (silent)** | Reports OK but doubles the rows: TRUNCATE is a no-op (issue 1) |
|
|
122
|
+
| Seeds, `--full-refresh` | PASS | Drops and recreates |
|
|
123
|
+
| Sources: `source()` reads | PASS | `samples.tpch_sf001.nation` |
|
|
124
|
+
| Sources: tests | PASS | not_null, unique |
|
|
125
|
+
| Sources: `dbt source freshness` | PASS | |
|
|
126
|
+
| View materialization | PASS | Created and replaced |
|
|
127
|
+
| Table materialization | PASS | Created; rebuilt through the rename swap |
|
|
128
|
+
| Incremental, `append` | PASS | Second run appends only new rows (checked 4 → 5) |
|
|
129
|
+
| Incremental, `merge`, first build | PASS | |
|
|
130
|
+
| Incremental, `merge`, incremental run | **FAIL** | Issue 3 |
|
|
131
|
+
| Tests: not_null, unique, singular | PASS | |
|
|
132
|
+
| Tests: accepted_values, relationships | **FAIL** | Issue 4 |
|
|
133
|
+
| `dbt docs generate` | PARTIAL | Catalog written; views have no columns (issue 5) |
|
|
134
|
+
| Schema creation (`CREATE COLLECTION`) | PASS with workaround | Issue 2 |
|
|
135
|
+
| Incremental, `delete+insert`, first build | PASS | |
|
|
136
|
+
| Incremental, `delete+insert`, incremental run | **FAIL** | Issues 11 and 12 |
|
|
137
|
+
| Ephemeral models | **FAIL** | Issue 13 |
|
|
138
|
+
| Snapshots (timestamp and check strategies) | **FAIL** | Issue 14; would then hit issue 3 |
|
|
139
|
+
| Unit tests | **FAIL** | Issue 5: fixtures need the input view's columns |
|
|
140
|
+
| `--empty` | **FAIL** | Issue 15 |
|
|
141
|
+
| Model contracts | **Refused** | The adapter raises (see above) |
|
|
142
|
+
| Pre/post hooks | PASS | Hook statements ran, checked in `hook_log` |
|
|
143
|
+
| `dbt show` | PASS | |
|
|
144
|
+
| `dbt run-operation` with `run_query` | PASS | |
|
|
145
|
+
|
|
146
|
+
## Issues found
|
|
147
|
+
|
|
148
|
+
| # | Issue | Class | Proposed fix |
|
|
149
|
+
|---|---|---|---|
|
|
150
|
+
| 1 | `TRUNCATE TABLE` reports OK and removes nothing. `OpteryxConnector.truncate_relation` calls `Dataset.truncate()`, whose default `commit_truncation=False` never moves `current-snapshot-id`. | Opteryx correctness bug | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the connector now passes `commit_truncation=True`. Re-run the matrix after deploy. |
|
|
151
|
+
| 2 | `CREATE/DROP COLLECTION` and `ALTER/DROP WORKSPACE` fail to parse after a leading comment. dbt puts a comment in front of every statement. | Opteryx SQL gap | Have the `^\s*` anchors in `opteryx/planner/sql_rewriter/__init__.py:240-251` skip leading comments. Docs workaround: `query-comment: {append: true}`. |
|
|
152
|
+
| 3 | `MERGE … WHEN NOT MATCHED THEN INSERT (…) VALUES ("id", …)` raises "Column id is ambiguous". Only the source is in scope there; qualified `S."id"` works. | Opteryx SQL gap | Bind WHEN NOT MATCHED value expressions against the source relation only. |
|
|
153
|
+
| 4 | A CTE inside a derived table is not found: `SELECT … FROM (WITH a AS (…) SELECT * FROM a) t` gives "Dataset `a` cannot be found". dbt wraps every test in such a subquery. | Opteryx SQL gap | Scope CTEs declared inside a subquery to that subquery. |
|
|
154
|
+
| 5 | `information_schema.columns` has no rows for views, so dbt cannot see view columns. | Opteryx SQL gap | List view columns there as well; it currently iterates `list_datasets()` only. |
|
|
155
|
+
| 6 | `personal.information_schema.schemata` is empty although `personal.<user>` exists. dbt then always issues `CREATE COLLECTION IF NOT EXISTS`, which succeeds. | Opteryx catalog gap (not blocking) | List the caller's personal collection. |
|
|
156
|
+
| 7 | CAST refuses `DOUBLE`, `BIGINT` and `TEXT` ("not a type CAST can produce") although `reference/types.json` lists them as accepted spellings. dbt's default seed types are `text` / `float8`. | Opteryx SQL gap | Accept the listed spellings in CAST. The adapter maps seed types itself meanwhile. |
|
|
157
|
+
| 8 | INSERT type errors print the enum repr, e.g. "target LogicalCategory.FLOAT". | Opteryx message bug | Render the type name. |
|
|
158
|
+
| 9 | Bind parameters of type `Decimal`, `date` or `datetime` fail with "not JSON serializable" in the DBAPI. | Adapter/protocol gap (opteryx-sqlalchemy) | Encode them in `_submit_statement`. Even then, the server will not coerce a string into DATE/TIMESTAMP, so this adapter's seeds use literals. |
|
|
159
|
+
| 10 | `ALTER TABLE x RENAME TO y` with a bare target is read as a move to another workspace. | Behaviour (documented) | None needed: the adapter always passes the qualified name. |
|
|
160
|
+
| 11 | `WHERE (id) IN (SELECT …)` with one parenthesised column fails: "A correlated EXISTS/IN subquery correlates on `(id)`…". Without the parentheses it works. dbt's delete+insert always parenthesises. | Opteryx SQL gap | Treat a one-element parenthesised expression as the expression itself. |
|
|
161
|
+
| 12 | **INSERT fails after a DELETE that removed every row** of the table's files: "concat: all inputs must share one type for 'column_uncompressed_sizes_in_bytes' - found INT64, ARRAY". Root cause is in rugo: a zero-row `array<…>` column reads back as INT64. The delete-all writes a manifest with one zero-row row group, INSERT appends a row group to it, and `read_manifest_columns` cannot combine the two. Three-line reproducer: write an empty ARRAY vector with `rugo.parquet.write_parquet`; `read_parquet` returns it as INT64. Not dbt-specific. | Opteryx correctness bug (rugo reader) | **Fixed in opteryx-core (2026-11-09, not yet released or deployed):** the reader routes list columns on the schema's `max_rep_level`, not on whether repetition levels were decoded. Manifests already written this way need no rewrite; they read correctly once the fix is deployed. |
|
|
162
|
+
| 13 | `CREATE TABLE … AS WITH a AS (…) SELECT … FROM a` gives "Dataset `a` cannot be found". The same query without CREATE works. dbt inlines ephemeral models this way. | Opteryx SQL gap | Resolve CTEs in a CTAS body. |
|
|
163
|
+
| 14 | `SELECT *, x` is refused by design ("`SELECT *` cannot coexist with additional columns"); `SELECT t.*, x` works. dbt's snapshot SQL uses `SELECT *, …`. | Opteryx dialect rule | Either allow `*` with other columns, or override dbt's snapshot macros in the adapter to qualify the star. Architect's call. |
|
|
164
|
+
| 15 | `WHERE false` is refused by design ("WHERE clause cannot be a bare literal"); `WHERE 1 = 0` works. dbt's `--empty` renders refs as `(SELECT * FROM x WHERE false LIMIT 0)`, and contract enforcement uses the same pattern. | Opteryx dialect rule | Either accept a bare boolean literal, or override the relation's limited render in the adapter. Architect's call. |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
dbt/adapters/opteryx/__init__.py
|
|
5
|
+
dbt/adapters/opteryx/__version__.py
|
|
6
|
+
dbt/adapters/opteryx/connections.py
|
|
7
|
+
dbt/adapters/opteryx/impl.py
|
|
8
|
+
dbt/include/opteryx/__init__.py
|
|
9
|
+
dbt/include/opteryx/dbt_project.yml
|
|
10
|
+
dbt/include/opteryx/macros/adapters.sql
|
|
11
|
+
dbt/include/opteryx/macros/catalog.sql
|
|
12
|
+
dbt/include/opteryx/macros/materializations/seed.sql
|
|
13
|
+
dbt/include/opteryx/macros/materializations/view.sql
|
|
14
|
+
dbt_opteryx.egg-info/PKG-INFO
|
|
15
|
+
dbt_opteryx.egg-info/SOURCES.txt
|
|
16
|
+
dbt_opteryx.egg-info/dependency_links.txt
|
|
17
|
+
dbt_opteryx.egg-info/requires.txt
|
|
18
|
+
dbt_opteryx.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dbt
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dbt-opteryx"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "dbt adapter for Opteryx Cloud (https://opteryx.app)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"dbt-core>=1.10,<2", # the integration project uses 1.10 test `arguments:` syntax
|
|
15
|
+
"dbt-adapters>=1.7,<2",
|
|
16
|
+
"dbt-common>=1.10,<2",
|
|
17
|
+
"opteryx-sqlalchemy>=0.0.13",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
include = ["dbt*"]
|
|
22
|
+
namespaces = true
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.dynamic]
|
|
25
|
+
version = { attr = "dbt.adapters.opteryx.__version__.version" }
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.package-data]
|
|
28
|
+
"dbt.include.opteryx" = ["dbt_project.yml", "macros/*.sql", "macros/**/*.sql"]
|