Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Loader: Update to CTK 0.0.27 #652

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/cratedb-toolkit/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cratedb-toolkit[influxdb,mongodb]==0.0.24
cratedb-toolkit[influxdb,mongodb]==0.0.27
8 changes: 7 additions & 1 deletion application/cratedb-toolkit/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_ctk_load_table_mongodb_json(drop_testing_tables):
"countries-small": 248,
"covers": 5071,
"grades": 280,
"products": 11,
"products": 10,
"profiles": 1515,
"restaurant": 2548,
"students": 200,
Expand All @@ -134,6 +134,12 @@ def test_ctk_load_table_mongodb_json(drop_testing_tables):
progress=GitProgressPrinter(),
)

# The `countries-big.json` file contains bogus characters.
countries_big_path = datasets_path / "countries-big.json"
payload = countries_big_path.read_text()
payload = payload.replace("\ufeff", "")
countries_big_path.write_text(payload)

# Invoke data transfer.
command = f"""
ctk load table \
Expand Down
81 changes: 74 additions & 7 deletions application/cratedb-toolkit/zyp-mongodb-json-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,78 @@
meta:
type: zyp-project
version: 1

collections:
- address:
container: datasets
name: companies
pre:
rules:
- expression: .[] |= del(.image.available_sizes, .screenshots[].available_sizes)
type: jq

- address:
container: datasets
name: books
pre:
rules:
- expression: .[] |= (._id |= tostring)
type: jq

- address:
container: datasets
name: city_inspections
pre:
rules:
- expression: |
.[] |= (
select(true)
| .address.number |= numbers
| .address.zip |= numbers
| .certificate_number |= tostring
)
type: jq

- address:
container: datasets
name: companies
pre:
rules:
- expression: |
.[] |= (
select(true)
|= del(.image.available_sizes, .screenshots[].available_sizes)
| .created_at |= strings
| .updated_at |= strings
)
type: jq

- address:
container: datasets
name: countries-big
pre:
rules:
- expression: .[] |= (.ISO |= tostring)
type: jq

- address:
container: datasets
name: products
pre:
rules:
- expression: |
.[] |= (
select(true)
| if (.for) then .for |= to_array end
| if (.type) then .type |= to_array end
| if (.limits.data.n) then .limits.data.n |= tostring end
| if (.limits.sms.n) then .limits.sms.n |= tostring end
| if (.limits.voice.n) then .limits.voice.n |= tostring end
)
type: jq

- address:
container: datasets
name: restaurant
pre:
rules:
- expression: |
.[] |= (
select(true)
| .rating |= tostring
| .type |= to_array
)
type: jq
Loading