-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'person/gageorgiev/log-module-leve' of github.com:vmware…
…/versatile-data-kit into person/gageorgiev/log-module-leve
- Loading branch information
Showing
42 changed files
with
1,136 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/control-service/projects/job-builder-rootless/version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.3.4 | ||
1.3.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.0 | ||
1.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 36 additions & 6 deletions
42
projects/vdk-core/tests/vdk/internal/builtin_plugins/ingestion/test_ingester_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,54 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import datetime | ||
import json | ||
from decimal import Decimal | ||
|
||
from pytest import raises | ||
from vdk.internal.builtin_plugins.ingestion.ingester_utils import DecimalJsonEncoder | ||
from vdk.internal.builtin_plugins.ingestion.ingester_utils import IngesterJsonEncoder | ||
|
||
|
||
def test_decimal_json_encoder(): | ||
payload_no_decimal = {"a": 1, "b": 2} | ||
def test_ingester_json_encoder(): | ||
payload_no_specials = {"a": 1, "b": 2} | ||
payload_with_decimal = {"a": Decimal(1), "b": Decimal(2)} | ||
payload_with_datetime = { | ||
"a": datetime.datetime.fromtimestamp(1700641925), | ||
"b": datetime.datetime.fromtimestamp(1700641925), | ||
} | ||
payload_with_bytes = { | ||
"a": b"enoded string bla bla", | ||
"b": b"another encoded string, look at me, I'm so special", | ||
} | ||
|
||
assert json.dumps(payload_no_decimal) == '{"a": 1, "b": 2}' | ||
assert json.dumps(payload_no_specials) == '{"a": 1, "b": 2}' | ||
|
||
with raises(TypeError): | ||
json.dumps(payload_with_decimal) | ||
|
||
assert json.dumps(payload_no_decimal, cls=DecimalJsonEncoder) == '{"a": 1, "b": 2}' | ||
with raises(TypeError): | ||
json.dumps(payload_with_datetime) | ||
|
||
with raises(TypeError): | ||
json.dumps(payload_with_bytes) | ||
|
||
assert ( | ||
json.dumps(payload_no_specials, cls=IngesterJsonEncoder) == '{"a": 1, "b": 2}' | ||
) | ||
|
||
assert ( | ||
json.dumps(payload_with_decimal, cls=DecimalJsonEncoder) | ||
json.dumps(payload_with_decimal, cls=IngesterJsonEncoder) | ||
== '{"a": 1.0, "b": 2.0}' | ||
) | ||
|
||
assert ( | ||
json.dumps(payload_with_datetime, cls=IngesterJsonEncoder) | ||
== '{"a": 1700641925.0, "b": 1700641925.0}' | ||
) | ||
|
||
assert json.dumps(payload_with_bytes, cls=IngesterJsonEncoder) == ( | ||
'{"a": [101, 110, 111, 100, 101, 100, 32, 115, 116, 114, 105, 110, 103, 32, ' | ||
'98, 108, 97, 32, 98, 108, 97], "b": [97, 110, 111, 116, 104, 101, 114, 32, ' | ||
"101, 110, 99, 111, 100, 101, 100, 32, 115, 116, 114, 105, 110, 103, 44, 32, " | ||
"108, 111, 111, 107, 32, 97, 116, 32, 109, 101, 44, 32, 73, 39, 109, 32, 115, " | ||
"111, 32, 115, 112, 101, 99, 105, 97, 108]}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
image: "python:3.7" | ||
|
||
.build-vdk-oracle: | ||
variables: | ||
PLUGIN_NAME: vdk-oracle | ||
extends: .build-plugin-dind | ||
|
||
build-py37-vdk-oracle: | ||
extends: .build-vdk-oracle | ||
image: "python:3.7" | ||
|
||
build-py311-vdk-oracle: | ||
extends: .build-vdk-oracle | ||
image: "python:3.11" | ||
|
||
release-vdk-oracle: | ||
variables: | ||
PLUGIN_NAME: vdk-oracle | ||
extends: .release-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# oracle | ||
|
||
Support for VDK Managed Oracle connection | ||
|
||
TODO: what the project is about, what is its purpose | ||
|
||
|
||
## Usage | ||
|
||
``` | ||
pip install vdk-oracle | ||
``` | ||
|
||
### Configuration | ||
|
||
(`vdk config-help` is useful command to browse all config options of your installation of vdk) | ||
|
||
| Name | Description | (example) Value | | ||
|--------------------------|--------------------------------------------------|----------------------| | ||
| oracle_user | Username used when connecting to Oracle database | "my_user" | | ||
| oracle_password | Password used when connecting to Oracle database | "super_secret_shhhh" | | ||
| oracle_connection_string | The Oracle connection string | "localhost/free" | | ||
|
||
### Example | ||
|
||
#### Ingestion | ||
|
||
```python | ||
import datetime | ||
from decimal import Decimal | ||
|
||
def run(job_input): | ||
|
||
# Ingest object | ||
payload_with_types = { | ||
"id": 5, | ||
"str_data": "string", | ||
"int_data": 12, | ||
"float_data": 1.2, | ||
"bool_data": True, | ||
"timestamp_data": datetime.datetime.fromtimestamp(1700554373), | ||
"decimal_data": Decimal(0.1), | ||
} | ||
|
||
job_input.send_object_for_ingestion( | ||
payload=payload_with_types, destination_table="test_table" | ||
) | ||
|
||
# Ingest tabular data | ||
col_names = [ | ||
"id", | ||
"str_data", | ||
"int_data", | ||
"float_data", | ||
"bool_data", | ||
"timestamp_data", | ||
"decimal_data", | ||
] | ||
row_data = [ | ||
[ | ||
0, | ||
"string", | ||
12, | ||
1.2, | ||
True, | ||
datetime.datetime.fromtimestamp(1700554373), | ||
Decimal(1.1), | ||
], | ||
[ | ||
1, | ||
"string", | ||
12, | ||
1.2, | ||
True, | ||
datetime.datetime.fromtimestamp(1700554373), | ||
Decimal(1.1), | ||
], | ||
[ | ||
2, | ||
"string", | ||
12, | ||
1.2, | ||
True, | ||
datetime.datetime.fromtimestamp(1700554373), | ||
Decimal(1.1), | ||
], | ||
] | ||
job_input.send_tabular_data_for_ingestion( | ||
rows=row_data, column_names=col_names, destination_table="test_table" | ||
) | ||
``` | ||
### Build and testing | ||
|
||
``` | ||
pip install -r requirements.txt | ||
pip install -e . | ||
pytest | ||
``` | ||
|
||
In VDK repo [../build-plugin.sh](https://github.com/vmware/versatile-data-kit/tree/main/projects/vdk-plugins/build-plugin.sh) script can be used also. | ||
|
||
|
||
#### Note about the CICD: | ||
|
||
.plugin-ci.yaml is needed only for plugins part of [Versatile Data Kit Plugin repo](https://github.com/vmware/versatile-data-kit/tree/main/projects/vdk-plugins). | ||
|
||
The CI/CD is separated in two stages, a build stage and a release stage. | ||
The build stage is made up of a few jobs, all which inherit from the same | ||
job configuration and only differ in the Python version they use (3.7, 3.8, 3.9 and 3.10). | ||
They run according to rules, which are ordered in a way such that changes to a | ||
plugin's directory trigger the plugin CI, but changes to a different plugin does not. |
Oops, something went wrong.