query-farm-airport-test-server 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.
- query_farm_airport_test_server-0.1.0/.gitignore +10 -0
- query_farm_airport_test_server-0.1.0/.python-version +1 -0
- query_farm_airport_test_server-0.1.0/PKG-INFO +40 -0
- query_farm_airport_test_server-0.1.0/README.md +26 -0
- query_farm_airport_test_server-0.1.0/pyproject.toml +94 -0
- query_farm_airport_test_server-0.1.0/requirements-dev.lock +117 -0
- query_farm_airport_test_server-0.1.0/requirements.lock +81 -0
- query_farm_airport_test_server-0.1.0/scripts/generate-types-tests.py +243 -0
- query_farm_airport_test_server-0.1.0/src/query_farm_airport_test_server/__init__.py +6 -0
- query_farm_airport_test_server-0.1.0/src/query_farm_airport_test_server/auth.py +9 -0
- query_farm_airport_test_server-0.1.0/src/query_farm_airport_test_server/py.typed +0 -0
- query_farm_airport_test_server-0.1.0/src/query_farm_airport_test_server/server.py +1799 -0
- query_farm_airport_test_server-0.1.0/src/query_farm_airport_test_server/utils.py +182 -0
@@ -0,0 +1 @@
|
|
1
|
+
3.12.4
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: query-farm-airport-test-server
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: An Apache Arrow Flight server that is used to test the Airport extension for DuckDB.
|
5
|
+
Project-URL: Repository, https://github.com/query-farm/python-airport-test-server.git
|
6
|
+
Project-URL: Issues, https://github.com/query-farm/python-airport-test-server/issues
|
7
|
+
Author-email: Rusty Conover <rusty@query.farm>
|
8
|
+
Requires-Python: >=3.12
|
9
|
+
Requires-Dist: duckdb>=1.3.1
|
10
|
+
Requires-Dist: pyarrow>=20.0.0
|
11
|
+
Requires-Dist: query-farm-duckdb-json-serialization>=0.1.1
|
12
|
+
Requires-Dist: query-farm-flight-server
|
13
|
+
Description-Content-Type: text/markdown
|
14
|
+
|
15
|
+
# query-farm-airport-test-server
|
16
|
+
|
17
|
+
**`query-farm-airport-test-server`** is a Python module that implements a lightweight in-memory Arrow Flight server for use with the [Airport DuckDB extension](https://airport.query.farm). It showcases nearly all of the Airport extension's capabilities and is designed primarily for testing and CI integration.
|
18
|
+
|
19
|
+
> ⚠️ This server is not intended as a tutorial or reference for writing Arrow Flight servers from scratch. Its purpose is to comprehensively test feature coverage, and the implementation reflects that complexity.
|
20
|
+
|
21
|
+
## Features
|
22
|
+
|
23
|
+
- In-memory storage — no persistent state
|
24
|
+
- Accepts any authentication token
|
25
|
+
- Supports full reset of data via client call
|
26
|
+
- Ideal for CI pipelines and integration tests
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
```sh
|
31
|
+
pip install query-farm-airport-test-server
|
32
|
+
```
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
```sh
|
37
|
+
$ airport_test_server
|
38
|
+
```
|
39
|
+
|
40
|
+
Once running, the server can be used with the test suite included in the Airport DuckDB extension.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# query-farm-airport-test-server
|
2
|
+
|
3
|
+
**`query-farm-airport-test-server`** is a Python module that implements a lightweight in-memory Arrow Flight server for use with the [Airport DuckDB extension](https://airport.query.farm). It showcases nearly all of the Airport extension's capabilities and is designed primarily for testing and CI integration.
|
4
|
+
|
5
|
+
> ⚠️ This server is not intended as a tutorial or reference for writing Arrow Flight servers from scratch. Its purpose is to comprehensively test feature coverage, and the implementation reflects that complexity.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
- In-memory storage — no persistent state
|
10
|
+
- Accepts any authentication token
|
11
|
+
- Supports full reset of data via client call
|
12
|
+
- Ideal for CI pipelines and integration tests
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```sh
|
17
|
+
pip install query-farm-airport-test-server
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```sh
|
23
|
+
$ airport_test_server
|
24
|
+
```
|
25
|
+
|
26
|
+
Once running, the server can be used with the test suite included in the Airport DuckDB extension.
|
@@ -0,0 +1,94 @@
|
|
1
|
+
[project]
|
2
|
+
name = "query-farm-airport-test-server"
|
3
|
+
version = "0.1.0"
|
4
|
+
description = "An Apache Arrow Flight server that is used to test the Airport extension for DuckDB."
|
5
|
+
authors = [
|
6
|
+
{ name = "Rusty Conover", email = "rusty@query.farm" }
|
7
|
+
]
|
8
|
+
dependencies = [
|
9
|
+
"pyarrow>=20.0.0",
|
10
|
+
"query-farm-flight-server",
|
11
|
+
# "query-farm-flight-server @ git+https://github.com/Query-farm/server_base.git@master",
|
12
|
+
"duckdb>=1.3.1",
|
13
|
+
"query-farm-duckdb-json-serialization>=0.1.1",
|
14
|
+
]
|
15
|
+
readme = "README.md"
|
16
|
+
requires-python = ">= 3.12"
|
17
|
+
|
18
|
+
|
19
|
+
[project.urls]
|
20
|
+
Repository = "https://github.com/query-farm/python-airport-test-server.git"
|
21
|
+
Issues = "https://github.com/query-farm/python-airport-test-server/issues"
|
22
|
+
|
23
|
+
[build-system]
|
24
|
+
requires = ["hatchling==1.26.3", "hatch-vcs"]
|
25
|
+
build-backend = "hatchling.build"
|
26
|
+
|
27
|
+
[tool.rye]
|
28
|
+
managed = true
|
29
|
+
dev-dependencies = [
|
30
|
+
"pytest>=8.3.2",
|
31
|
+
"pytest-mypy>=0.10.3",
|
32
|
+
"pytest-env>=1.1.3",
|
33
|
+
"pytest-cov>=5.0.0",
|
34
|
+
"pytest-parallel>=0.1.1",
|
35
|
+
"pytest-xdist>=3.6.1",
|
36
|
+
"ruff==0.11.2",
|
37
|
+
]
|
38
|
+
|
39
|
+
|
40
|
+
[tool.hatch.metadata]
|
41
|
+
allow-direct-references = true
|
42
|
+
|
43
|
+
[tool.hatch.build.targets.wheel]
|
44
|
+
packages = ["src/query_farm_airport_test_server"]
|
45
|
+
|
46
|
+
[project.scripts]
|
47
|
+
airport_test_server = 'query_farm_airport_test_server:do_server'
|
48
|
+
|
49
|
+
[tool.rye.scripts]
|
50
|
+
dev = { cmd = "airport_test_server --location grpc://0.0.0.0:50003", description = "Run the test server" }
|
51
|
+
|
52
|
+
[tool.pytest]
|
53
|
+
|
54
|
+
|
55
|
+
[tool.mypy]
|
56
|
+
ignore_missing_imports = true
|
57
|
+
plugins = ["pydantic.mypy"]
|
58
|
+
|
59
|
+
|
60
|
+
follow_imports = "silent"
|
61
|
+
warn_redundant_casts = true
|
62
|
+
warn_unused_ignores = true
|
63
|
+
disallow_any_generics = true
|
64
|
+
check_untyped_defs = true
|
65
|
+
no_implicit_reexport = true
|
66
|
+
|
67
|
+
# for strict mypy: (this is the tricky one :-))
|
68
|
+
disallow_untyped_defs = true
|
69
|
+
|
70
|
+
|
71
|
+
[tool.pydantic.mypy]
|
72
|
+
init_forbid_extra = true
|
73
|
+
init_typed = true
|
74
|
+
warn_required_dynamic_aliases = true
|
75
|
+
|
76
|
+
[tool.ruff]
|
77
|
+
line-length = 120
|
78
|
+
|
79
|
+
[tool.ruff.lint]
|
80
|
+
select = [
|
81
|
+
# pycodestyle
|
82
|
+
"E",
|
83
|
+
# Pyflakes
|
84
|
+
"F",
|
85
|
+
# pyupgrade
|
86
|
+
"UP",
|
87
|
+
# flake8-bugbear
|
88
|
+
"B",
|
89
|
+
# flake8-simplify
|
90
|
+
"SIM",
|
91
|
+
# isort
|
92
|
+
"I",
|
93
|
+
]
|
94
|
+
ignore = ['E501']
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# generated by rye
|
2
|
+
# use `rye lock` or `rye sync` to update this lockfile
|
3
|
+
#
|
4
|
+
# last locked with the following flags:
|
5
|
+
# pre: false
|
6
|
+
# features: []
|
7
|
+
# all-features: false
|
8
|
+
# with-sources: false
|
9
|
+
# generate-hashes: false
|
10
|
+
# universal: false
|
11
|
+
|
12
|
+
-e file:.
|
13
|
+
annotated-types==0.7.0
|
14
|
+
# via pydantic
|
15
|
+
boto3==1.39.0
|
16
|
+
# via query-farm-flight-server
|
17
|
+
botocore==1.39.0
|
18
|
+
# via boto3
|
19
|
+
# via s3transfer
|
20
|
+
cache3==0.4.3
|
21
|
+
# via query-farm-flight-server
|
22
|
+
certifi==2025.6.15
|
23
|
+
# via sentry-sdk
|
24
|
+
click==8.2.1
|
25
|
+
# via query-farm-flight-server
|
26
|
+
coverage==7.9.1
|
27
|
+
# via pytest-cov
|
28
|
+
duckdb==1.3.1
|
29
|
+
# via query-farm-airport-test-server
|
30
|
+
execnet==2.1.1
|
31
|
+
# via pytest-xdist
|
32
|
+
filelock==3.18.0
|
33
|
+
# via pytest-mypy
|
34
|
+
fuzzywuzzy==0.18.0
|
35
|
+
# via query-farm-flight-server
|
36
|
+
iniconfig==2.1.0
|
37
|
+
# via pytest
|
38
|
+
jmespath==1.0.1
|
39
|
+
# via boto3
|
40
|
+
# via botocore
|
41
|
+
levenshtein==0.27.1
|
42
|
+
# via python-levenshtein
|
43
|
+
msgpack==1.1.1
|
44
|
+
# via query-farm-flight-server
|
45
|
+
mypy==1.16.1
|
46
|
+
# via pytest-mypy
|
47
|
+
mypy-boto3-dynamodb==1.39.0
|
48
|
+
# via query-farm-flight-server
|
49
|
+
mypy-boto3-s3==1.39.0
|
50
|
+
# via query-farm-flight-server
|
51
|
+
mypy-extensions==1.1.0
|
52
|
+
# via mypy
|
53
|
+
packaging==25.0
|
54
|
+
# via pytest
|
55
|
+
pathspec==0.12.1
|
56
|
+
# via mypy
|
57
|
+
pluggy==1.6.0
|
58
|
+
# via pytest
|
59
|
+
# via pytest-cov
|
60
|
+
prettytable==3.16.0
|
61
|
+
# via query-farm-flight-server
|
62
|
+
pyarrow==20.0.0
|
63
|
+
# via query-farm-airport-test-server
|
64
|
+
# via query-farm-flight-server
|
65
|
+
pydantic==2.11.7
|
66
|
+
# via query-farm-duckdb-json-serialization
|
67
|
+
# via query-farm-flight-server
|
68
|
+
pydantic-core==2.33.2
|
69
|
+
# via pydantic
|
70
|
+
pygments==2.19.2
|
71
|
+
# via pytest
|
72
|
+
pytest==8.4.1
|
73
|
+
# via pytest-cov
|
74
|
+
# via pytest-env
|
75
|
+
# via pytest-mypy
|
76
|
+
# via pytest-parallel
|
77
|
+
# via pytest-xdist
|
78
|
+
pytest-cov==6.2.1
|
79
|
+
pytest-env==1.1.5
|
80
|
+
pytest-mypy==1.0.1
|
81
|
+
pytest-parallel==0.1.1
|
82
|
+
pytest-xdist==3.7.0
|
83
|
+
python-dateutil==2.9.0.post0
|
84
|
+
# via botocore
|
85
|
+
python-levenshtein==0.27.1
|
86
|
+
# via query-farm-flight-server
|
87
|
+
query-farm-duckdb-json-serialization==0.1.1
|
88
|
+
# via query-farm-airport-test-server
|
89
|
+
query-farm-flight-server==0.1.2
|
90
|
+
# via query-farm-airport-test-server
|
91
|
+
rapidfuzz==3.13.0
|
92
|
+
# via levenshtein
|
93
|
+
ruff==0.11.2
|
94
|
+
s3transfer==0.13.0
|
95
|
+
# via boto3
|
96
|
+
sentry-sdk==2.32.0
|
97
|
+
# via query-farm-flight-server
|
98
|
+
six==1.17.0
|
99
|
+
# via python-dateutil
|
100
|
+
structlog==25.4.0
|
101
|
+
# via query-farm-flight-server
|
102
|
+
tblib==3.1.0
|
103
|
+
# via pytest-parallel
|
104
|
+
typing-extensions==4.14.0
|
105
|
+
# via mypy
|
106
|
+
# via pydantic
|
107
|
+
# via pydantic-core
|
108
|
+
# via typing-inspection
|
109
|
+
typing-inspection==0.4.1
|
110
|
+
# via pydantic
|
111
|
+
urllib3==2.5.0
|
112
|
+
# via botocore
|
113
|
+
# via sentry-sdk
|
114
|
+
wcwidth==0.2.13
|
115
|
+
# via prettytable
|
116
|
+
zstandard==0.23.0
|
117
|
+
# via query-farm-flight-server
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# generated by rye
|
2
|
+
# use `rye lock` or `rye sync` to update this lockfile
|
3
|
+
#
|
4
|
+
# last locked with the following flags:
|
5
|
+
# pre: false
|
6
|
+
# features: []
|
7
|
+
# all-features: false
|
8
|
+
# with-sources: false
|
9
|
+
# generate-hashes: false
|
10
|
+
# universal: false
|
11
|
+
|
12
|
+
-e file:.
|
13
|
+
annotated-types==0.7.0
|
14
|
+
# via pydantic
|
15
|
+
boto3==1.39.0
|
16
|
+
# via query-farm-flight-server
|
17
|
+
botocore==1.39.0
|
18
|
+
# via boto3
|
19
|
+
# via s3transfer
|
20
|
+
cache3==0.4.3
|
21
|
+
# via query-farm-flight-server
|
22
|
+
certifi==2025.6.15
|
23
|
+
# via sentry-sdk
|
24
|
+
click==8.2.1
|
25
|
+
# via query-farm-flight-server
|
26
|
+
duckdb==1.3.1
|
27
|
+
# via query-farm-airport-test-server
|
28
|
+
fuzzywuzzy==0.18.0
|
29
|
+
# via query-farm-flight-server
|
30
|
+
jmespath==1.0.1
|
31
|
+
# via boto3
|
32
|
+
# via botocore
|
33
|
+
levenshtein==0.27.1
|
34
|
+
# via python-levenshtein
|
35
|
+
msgpack==1.1.1
|
36
|
+
# via query-farm-flight-server
|
37
|
+
mypy-boto3-dynamodb==1.39.0
|
38
|
+
# via query-farm-flight-server
|
39
|
+
mypy-boto3-s3==1.39.0
|
40
|
+
# via query-farm-flight-server
|
41
|
+
prettytable==3.16.0
|
42
|
+
# via query-farm-flight-server
|
43
|
+
pyarrow==20.0.0
|
44
|
+
# via query-farm-airport-test-server
|
45
|
+
# via query-farm-flight-server
|
46
|
+
pydantic==2.11.7
|
47
|
+
# via query-farm-duckdb-json-serialization
|
48
|
+
# via query-farm-flight-server
|
49
|
+
pydantic-core==2.33.2
|
50
|
+
# via pydantic
|
51
|
+
python-dateutil==2.9.0.post0
|
52
|
+
# via botocore
|
53
|
+
python-levenshtein==0.27.1
|
54
|
+
# via query-farm-flight-server
|
55
|
+
query-farm-duckdb-json-serialization==0.1.1
|
56
|
+
# via query-farm-airport-test-server
|
57
|
+
query-farm-flight-server==0.1.2
|
58
|
+
# via query-farm-airport-test-server
|
59
|
+
rapidfuzz==3.13.0
|
60
|
+
# via levenshtein
|
61
|
+
s3transfer==0.13.0
|
62
|
+
# via boto3
|
63
|
+
sentry-sdk==2.32.0
|
64
|
+
# via query-farm-flight-server
|
65
|
+
six==1.17.0
|
66
|
+
# via python-dateutil
|
67
|
+
structlog==25.4.0
|
68
|
+
# via query-farm-flight-server
|
69
|
+
typing-extensions==4.14.0
|
70
|
+
# via pydantic
|
71
|
+
# via pydantic-core
|
72
|
+
# via typing-inspection
|
73
|
+
typing-inspection==0.4.1
|
74
|
+
# via pydantic
|
75
|
+
urllib3==2.5.0
|
76
|
+
# via botocore
|
77
|
+
# via sentry-sdk
|
78
|
+
wcwidth==0.2.13
|
79
|
+
# via prettytable
|
80
|
+
zstandard==0.23.0
|
81
|
+
# via query-farm-flight-server
|
@@ -0,0 +1,243 @@
|
|
1
|
+
# Generate a bunch of tests for the airport extension
|
2
|
+
# from a list of basic types.
|
3
|
+
|
4
|
+
import math
|
5
|
+
|
6
|
+
|
7
|
+
def unescape_value(value):
|
8
|
+
"""Unescape the value for display."""
|
9
|
+
if value.startswith("'") and value.endswith("'"):
|
10
|
+
return value[1:-1].replace("''", "'") # Remove single quotes
|
11
|
+
return value
|
12
|
+
|
13
|
+
|
14
|
+
def parse_to_float(val):
|
15
|
+
if isinstance(val, str):
|
16
|
+
v = val.replace("'", "") # Remove single quotes
|
17
|
+
try:
|
18
|
+
return float(v)
|
19
|
+
except ValueError:
|
20
|
+
return float("nan") # fallback if an unexpected string
|
21
|
+
return val # already a float
|
22
|
+
|
23
|
+
|
24
|
+
def sort_key(val):
|
25
|
+
x = parse_to_float(val)
|
26
|
+
if math.isnan(x):
|
27
|
+
return (3,)
|
28
|
+
elif x == float("-inf"):
|
29
|
+
return (0,)
|
30
|
+
elif x == float("inf"):
|
31
|
+
return (2,)
|
32
|
+
else:
|
33
|
+
return (1, x)
|
34
|
+
|
35
|
+
|
36
|
+
def custom_sorted(values):
|
37
|
+
if "'inf'" in values or "'-inf'" in values or "'nan'" in values:
|
38
|
+
# Sort using the custom key
|
39
|
+
return sorted(values, key=sort_key)
|
40
|
+
|
41
|
+
return sorted(values)
|
42
|
+
|
43
|
+
|
44
|
+
data = [
|
45
|
+
{"field_name": "bigint", "type": "bigint", "values": ["1234567890123456789"], "type_code": "I"},
|
46
|
+
{"field_name": "binary", "type": "binary", "values": ["'1234567890abcdef'"], "type_code": "T"},
|
47
|
+
{"field_name": "bit", "type": "bit", "values": ["'1'"], "type_code": "T"},
|
48
|
+
{"field_name": "bitstring", "type": "bitstring", "values": ["'101010'"], "type_code": "T"},
|
49
|
+
{"field_name": "blob", "type": "blob", "values": ["'This is a blob'"], "type_code": "T"},
|
50
|
+
{"field_name": "bool", "type": "bool", "values": ["1", "0"], "type_code": "I"},
|
51
|
+
{"field_name": "boolean", "type": "boolean", "values": ["true", "false"], "type_code": "I"},
|
52
|
+
{"field_name": "bpchar", "type": "bpchar", "values": ["'test'"], "type_code": "T"},
|
53
|
+
{"field_name": "bytea", "type": "bytea", "values": ["'1234567890abcdef'"], "type_code": "T"},
|
54
|
+
{"field_name": "char", "type": "char", "values": ["'A'"], "type_code": "T"},
|
55
|
+
{"field_name": "date", "type": "date", "values": ["'2023-10-01'", "'infinity'", "'-infinity'"], "type_code": "T"},
|
56
|
+
{"field_name": "datetime", "type": "datetime", "values": ["'2023-10-01 12:00:00'"], "type_code": "T"},
|
57
|
+
{"field_name": "dec", "type": "dec", "values": ["123.45"], "type_code": "R"},
|
58
|
+
{"field_name": "decimal", "type": "decimal", "values": ["123.45"], "type_code": "R"},
|
59
|
+
{
|
60
|
+
"field_name": "double",
|
61
|
+
"type": "double",
|
62
|
+
"values": ["123.456789", "'inf'", "'-inf'", "'nan'"],
|
63
|
+
"type_code": "R",
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"field_name": "float",
|
67
|
+
"type": "float",
|
68
|
+
"values": ["123.456", "'inf'", "'-inf'", "'nan'"],
|
69
|
+
"type_code": "R",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"field_name": "float4",
|
73
|
+
"type": "float4",
|
74
|
+
"values": ["123.456", "'inf'", "'-inf'", "'nan'"],
|
75
|
+
"type_code": "R",
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"field_name": "float8",
|
79
|
+
"type": "float8",
|
80
|
+
"values": ["123.456789", "'inf'", "'-inf'", "'nan'"],
|
81
|
+
"type_code": "R",
|
82
|
+
},
|
83
|
+
{"field_name": "guid", "type": "guid", "values": ["'123e4567-e89b-12d3-a456-426614174000'"], "type_code": "T"},
|
84
|
+
{"field_name": "hugeint", "type": "hugeint", "values": ["123456789012345678901234567890"], "type_code": "I"},
|
85
|
+
{"field_name": "int", "type": "int", "values": ["123456"], "type_code": "I"},
|
86
|
+
{"field_name": "int1", "type": "int1", "values": ["1"], "type_code": "I"},
|
87
|
+
{"field_name": "int128", "type": "int128", "values": ["123456789012345678901234567890123456"], "type_code": "I"},
|
88
|
+
{"field_name": "int16", "type": "int16", "values": ["12345", "-122"], "type_code": "I"},
|
89
|
+
{"field_name": "int2", "type": "int2", "values": ["1234"], "type_code": "I"},
|
90
|
+
{"field_name": "int32", "type": "int32", "values": ["12345678", "-222292"], "type_code": "I"},
|
91
|
+
{"field_name": "int4", "type": "int4", "values": ["123456789"], "type_code": "I"},
|
92
|
+
{"field_name": "int64", "type": "int64", "values": ["1234567890123456789"], "type_code": "I"},
|
93
|
+
{"field_name": "int8", "type": "int8", "values": ["123"], "type_code": "I"},
|
94
|
+
{"field_name": "integer", "type": "integer", "values": ["123456"], "type_code": "I"},
|
95
|
+
{"field_name": "integral", "type": "integral", "values": ["123456"], "type_code": "I"},
|
96
|
+
{"field_name": "interval", "type": "interval", "values": ["'1 day 02:03:04'"], "type_code": "T"},
|
97
|
+
{"field_name": "logical", "type": "logical", "values": ["true", "false"], "type_code": "I"},
|
98
|
+
{"field_name": "long", "type": "long", "values": ["1234567890123456789"], "type_code": "I"},
|
99
|
+
{"field_name": "numeric", "type": "numeric", "values": ["123.456", "-987.321"], "type_code": "R"},
|
100
|
+
{"field_name": "nvarchar", "type": "nvarchar", "values": ["'test'"], "type_code": "T"},
|
101
|
+
{"field_name": "oid", "type": "oid", "values": ["123456"], "type_code": "I"},
|
102
|
+
{"field_name": "real", "type": "real", "values": ["123.456"], "type_code": "R"},
|
103
|
+
{"field_name": "short", "type": "short", "values": ["12345"], "type_code": "I"},
|
104
|
+
{"field_name": "signed", "type": "signed", "values": ["123456", "-5"], "type_code": "I"},
|
105
|
+
{"field_name": "smallint", "type": "smallint", "values": ["12345"], "type_code": "I"},
|
106
|
+
{"field_name": "string", "type": "string", "values": ["'test'"], "type_code": "T"},
|
107
|
+
{
|
108
|
+
"field_name": "struct",
|
109
|
+
"type": "STRUCT(k1 int32, k2 int64)",
|
110
|
+
"values": ["{'k1': 5555, 'k2': 123}"],
|
111
|
+
"type_code": "T",
|
112
|
+
},
|
113
|
+
{"field_name": "text", "type": "text", "values": ["'This is a text field'"], "type_code": "T"},
|
114
|
+
{"field_name": "time", "type": "time", "values": ["'12:34:56'"], "type_code": "T"},
|
115
|
+
{"field_name": "timestamp", "type": "timestamp", "values": ["'2023-10-01 12:34:56'"], "type_code": "T"},
|
116
|
+
{"field_name": "timestamp_ms", "type": "timestamp_ms", "values": ["'2023-10-01 12:34:56.789'"], "type_code": "T"},
|
117
|
+
{
|
118
|
+
"field_name": "timestamp_ns",
|
119
|
+
"type": "timestamp_ns",
|
120
|
+
"values": ["'2023-10-01 12:34:56.789123456'"],
|
121
|
+
"type_code": "T",
|
122
|
+
},
|
123
|
+
{"field_name": "timestamp_s", "type": "timestamp_s", "values": ["'2023-10-01 12:34:56'"], "type_code": "T"},
|
124
|
+
{
|
125
|
+
"field_name": "timestamp_us",
|
126
|
+
"type": "timestamp_us",
|
127
|
+
"values": ["'2023-10-01 12:34:56.789123'"],
|
128
|
+
"type_code": "T",
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"field_name": "timestamptz",
|
132
|
+
"type": "timestamptz",
|
133
|
+
"values": ["'2023-10-01 12:34:56+00'"],
|
134
|
+
"type_code": "T",
|
135
|
+
},
|
136
|
+
{"field_name": "timetz", "type": "timetz", "values": ["'12:34:56'"], "type_code": "T"},
|
137
|
+
{"field_name": "tinyint", "type": "tinyint", "values": ["123"], "type_code": "I"},
|
138
|
+
{"field_name": "ubigint", "type": "ubigint", "values": ["1234567890123456789"], "type_code": "I"},
|
139
|
+
{"field_name": "uhugeint", "type": "uhugeint", "values": ["123456789012345678901234567890"], "type_code": "I"},
|
140
|
+
{"field_name": "uint128", "type": "uint128", "values": ["123456789012345678901234567890123456"], "type_code": "I"},
|
141
|
+
{"field_name": "uint16", "type": "uint16", "values": ["12345"], "type_code": "I"},
|
142
|
+
{"field_name": "uint32", "type": "uint32", "values": ["12345678"], "type_code": "I"},
|
143
|
+
{"field_name": "uint64", "type": "uint64", "values": ["1234567890123456789"], "type_code": "I"},
|
144
|
+
{"field_name": "uint8", "type": "uint8", "values": ["123"], "type_code": "I"},
|
145
|
+
{"field_name": "uinteger", "type": "uinteger", "values": ["123456"], "type_code": "I"},
|
146
|
+
{"field_name": "usmallint", "type": "usmallint", "values": ["12345"], "type_code": "I"},
|
147
|
+
{"field_name": "utinyint", "type": "utinyint", "values": ["123"], "type_code": "I"},
|
148
|
+
{
|
149
|
+
"field_name": "uuid",
|
150
|
+
"type": "uuid",
|
151
|
+
"values": ["'123e4567-e89b-12d3-a456-426614174000'", "'ffffffff-ffff-ffff-ffff-ffffffffffff'"],
|
152
|
+
"type_code": "T",
|
153
|
+
},
|
154
|
+
{"field_name": "varbinary", "type": "varbinary", "values": ["'1234567890abcdef'"], "type_code": "T"},
|
155
|
+
{
|
156
|
+
"field_name": "varchar",
|
157
|
+
"type": "varchar",
|
158
|
+
"values": ["'test'", "'rusty''s favorite'", "'🦆'"],
|
159
|
+
"type_code": "T",
|
160
|
+
},
|
161
|
+
{"field_name": "varint", "type": "varint", "values": ["1234567890123456789"], "type_code": "I"},
|
162
|
+
]
|
163
|
+
|
164
|
+
|
165
|
+
for record in data:
|
166
|
+
with open(
|
167
|
+
f"/Users/rusty/Development/duckdb-arrow-flight-extension/test/sql/airport-test-types-{record['field_name']}.test",
|
168
|
+
"w",
|
169
|
+
) as f:
|
170
|
+
print(
|
171
|
+
f"""# name: test/sql/airport-test-types-{record["field_name"]}.test
|
172
|
+
# description: test airport with all data types
|
173
|
+
# group: [airport]
|
174
|
+
|
175
|
+
# Require statement will ensure this test is run with this extension loaded
|
176
|
+
require airport
|
177
|
+
|
178
|
+
# Create the initial secret, the token value doesn't matter.
|
179
|
+
statement ok
|
180
|
+
CREATE SECRET airport_testing (
|
181
|
+
type airport,
|
182
|
+
auth_token 'example_token',
|
183
|
+
scope 'grpc://localhost:50003/');
|
184
|
+
|
185
|
+
# Reset the test server
|
186
|
+
statement ok
|
187
|
+
CALL airport_action('grpc://localhost:50003/', 'reset');
|
188
|
+
|
189
|
+
# Create the initial database
|
190
|
+
statement ok
|
191
|
+
CALL airport_action('grpc://localhost:50003/', 'create_database', 'test1');
|
192
|
+
|
193
|
+
statement ok
|
194
|
+
ATTACH 'test1' (TYPE AIRPORT, location 'grpc://localhost:50003/');
|
195
|
+
""",
|
196
|
+
file=f,
|
197
|
+
)
|
198
|
+
|
199
|
+
for schema_name in ["test_non_predicate", "test_predicate_pushdown"]:
|
200
|
+
print(
|
201
|
+
f"""
|
202
|
+
statement ok
|
203
|
+
CREATE SCHEMA test1.{schema_name};
|
204
|
+
|
205
|
+
statement ok
|
206
|
+
use test1.{schema_name};
|
207
|
+
""",
|
208
|
+
file=f,
|
209
|
+
)
|
210
|
+
|
211
|
+
table_name = f"test_type_{record['field_name']}"
|
212
|
+
print(
|
213
|
+
f"""statement ok
|
214
|
+
create table {table_name} (v {record["type"]});
|
215
|
+
|
216
|
+
statement ok
|
217
|
+
insert into {table_name} values (null);
|
218
|
+
""",
|
219
|
+
file=f,
|
220
|
+
)
|
221
|
+
for value in record["values"]:
|
222
|
+
print(
|
223
|
+
f"""statement ok
|
224
|
+
insert into {table_name} values ({value});
|
225
|
+
|
226
|
+
""",
|
227
|
+
file=f,
|
228
|
+
)
|
229
|
+
|
230
|
+
print(f"query {record['type_code']}", file=f)
|
231
|
+
print(f"select * from {table_name} order by 1", file=f)
|
232
|
+
print("----", file=f)
|
233
|
+
for value in custom_sorted(record["values"]):
|
234
|
+
print(unescape_value(value), file=f)
|
235
|
+
print("NULL", file=f)
|
236
|
+
print("", file=f)
|
237
|
+
|
238
|
+
for value in custom_sorted(record["values"]):
|
239
|
+
print(f"query {record['type_code']}", file=f)
|
240
|
+
print(f"select v from {table_name} where v = {value};", file=f)
|
241
|
+
print("----", file=f)
|
242
|
+
print(unescape_value(value), file=f)
|
243
|
+
print("", file=f)
|
File without changes
|