Skip to content

Commit

Permalink
Fix javascript feature and plumb features through to dozer-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse-Bakker committed Mar 12, 2024
1 parent 898ad5b commit 3da183a
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 68 deletions.
2 changes: 2 additions & 0 deletions dozer-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ snowflake = ["dozer-ingestion/snowflake"]
mongodb = ["dozer-ingestion/mongodb"]
onnx = ["dozer-sql/onnx"]
tokio-console = ["dozer-tracing/tokio-console"]
javascript = ["dozer-ingestion/javascript", "dozer-sql/javascript"]
datafusion = ["dozer-ingestion/datafusion"]
4 changes: 2 additions & 2 deletions dozer-ingestion/tests/test_suite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ pub use basic::{
#[cfg(feature = "mongodb")]
pub use connectors::MongodbConnectorTest;

pub use connectors::PostgresConnectorTest;
#[cfg(feature = "datafusion")]
pub use LocalStorageObjectStoreConnectorTest;
pub use connectors::LocalStorageObjectStoreConnectorTest;
pub use connectors::PostgresConnectorTest;
1 change: 1 addition & 0 deletions dozer-sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ proptest = "1.3.1"
[features]
python = ["dozer-sql-expression/python"]
onnx = ["dozer-sql-expression/onnx"]
javascript = ["dozer-sql-expression/javascript"]
4 changes: 2 additions & 2 deletions dozer-sql/expression/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl ExpressionBuilder {
}

UdfType::JavaScript(config) => {
#[cfg(feature = "javasscript")]
#[cfg(feature = "javascript")]
{
self.parse_javascript_udf(
function_name.clone(),
Expand All @@ -562,7 +562,7 @@ impl ExpressionBuilder {
#[cfg(not(feature = "javascript"))]
{
let _ = config;
Err(Error::OnnxNotEnabled)
Err(Error::JavaScriptNotEnabled)
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion dozer-sql/expression/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub enum Error {
#[error("Javascript is not enabled")]
JavaScriptNotEnabled,

#[cfg(feature = "javasscript")]
#[cfg(feature = "javascript")]
#[error("JavaScript UDF error: {0}")]
JavaScript(#[from] crate::javascript::Error),

Expand Down
50 changes: 25 additions & 25 deletions json_schemas/connections.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"description": "Configuration for a Postgres connection",
"examples": [
{
"database": "postgres",
"host": "localhost",
"user": "postgres",
"password": "postgres",
"host": "localhost",
"port": 5432,
"schema": "public",
"user": "postgres"
"database": "postgres",
"schema": "public"
}
],
"type": "object",
Expand Down Expand Up @@ -97,11 +97,11 @@
{
"provider": {
"Log": {
"wss_url": "",
"filter": {
"from_block": 0,
"to_block": null
},
"wss_url": ""
}
}
}
}
Expand Down Expand Up @@ -266,12 +266,12 @@
"title": "GrpcConfig",
"examples": [
{
"adapter": "arrow",
"host": "localhost",
"port": 50051,
"schemas": {
"Path": "schema.json"
}
},
"adapter": "arrow"
}
],
"type": "object",
Expand Down Expand Up @@ -342,15 +342,15 @@
"title": "SnowflakeConfig",
"examples": [
{
"database": "database",
"driver": "SnowflakeDSIIDriver",
"password": "password",
"port": "443",
"role": "role",
"schema": "schema",
"server": "<account_name>.<region_id>.snowflakecomputing.com",
"port": "443",
"user": "bob",
"warehouse": "warehouse"
"password": "password",
"database": "database",
"schema": "schema",
"warehouse": "warehouse",
"driver": "SnowflakeDSIIDriver",
"role": "role"
}
],
"type": "object",
Expand Down Expand Up @@ -439,16 +439,16 @@
{
"details": {
"access_key_id": "",
"bucket_name": "",
"secret_access_key": "",
"region": "",
"secret_access_key": ""
"bucket_name": ""
},
"tables": [
{
"config": {
"CSV": {
"extension": ".csv",
"path": "path/to/file"
"path": "path/to/file",
"extension": ".csv"
}
},
"name": "table_name"
Expand Down Expand Up @@ -598,8 +598,8 @@
{
"config": {
"CSV": {
"extension": ".csv",
"path": "path/to/table"
"path": "path/to/table",
"extension": ".csv"
}
},
"name": "table_name"
Expand Down Expand Up @@ -732,8 +732,8 @@
{
"tables": [
{
"name": "",
"path": ""
"path": "",
"name": ""
}
]
}
Expand Down Expand Up @@ -797,8 +797,8 @@
"title": "MySQLConfig",
"examples": [
{
"server_id": 1,
"url": "mysql://root:1234@localhost:3306/db_name"
"url": "mysql://root:1234@localhost:3306/db_name",
"server_id": 1
}
],
"type": "object",
Expand Down
76 changes: 38 additions & 38 deletions json_schemas/dozer.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
},
"replication": {
"default": {
"datacenter": "esp",
"server_address": "0.0.0.0",
"server_port": 5929
"server_port": 5929,
"datacenter": "esp"
},
"allOf": [
{
Expand Down Expand Up @@ -829,8 +829,8 @@
{
"tables": [
{
"name": "",
"path": ""
"path": "",
"name": ""
}
]
}
Expand Down Expand Up @@ -968,11 +968,11 @@
{
"provider": {
"Log": {
"wss_url": "",
"filter": {
"from_block": 0,
"to_block": null
},
"wss_url": ""
}
}
}
}
Expand Down Expand Up @@ -1217,12 +1217,12 @@
"GrpcConfig": {
"examples": [
{
"adapter": "arrow",
"host": "localhost",
"port": 50051,
"schemas": {
"Path": "schema.json"
}
},
"adapter": "arrow"
}
],
"type": "object",
Expand Down Expand Up @@ -1355,8 +1355,8 @@
{
"config": {
"CSV": {
"extension": ".csv",
"path": "path/to/table"
"path": "path/to/table",
"extension": ".csv"
}
},
"name": "table_name"
Expand Down Expand Up @@ -1400,8 +1400,8 @@
"MySQLConfig": {
"examples": [
{
"server_id": 1,
"url": "mysql://root:1234@localhost:3306/db_name"
"url": "mysql://root:1234@localhost:3306/db_name",
"server_id": 1
}
],
"type": "object",
Expand Down Expand Up @@ -1597,12 +1597,12 @@
"description": "Configuration for a Postgres connection",
"examples": [
{
"database": "postgres",
"host": "localhost",
"user": "postgres",
"password": "postgres",
"host": "localhost",
"port": 5432,
"schema": "public",
"user": "postgres"
"database": "postgres",
"schema": "public"
}
],
"type": "object",
Expand Down Expand Up @@ -1768,16 +1768,16 @@
{
"details": {
"access_key_id": "",
"bucket_name": "",
"secret_access_key": "",
"region": "",
"secret_access_key": ""
"bucket_name": ""
},
"tables": [
{
"config": {
"CSV": {
"extension": ".csv",
"path": "path/to/file"
"path": "path/to/file",
"extension": ".csv"
}
},
"name": "table_name"
Expand Down Expand Up @@ -1873,15 +1873,15 @@
"SnowflakeConfig": {
"examples": [
{
"database": "database",
"driver": "SnowflakeDSIIDriver",
"password": "password",
"port": "443",
"role": "role",
"schema": "schema",
"server": "<account_name>.<region_id>.snowflakecomputing.com",
"port": "443",
"user": "bob",
"warehouse": "warehouse"
"password": "password",
"database": "database",
"schema": "schema",
"warehouse": "warehouse",
"driver": "SnowflakeDSIIDriver",
"role": "role"
}
],
"type": "object",
Expand Down Expand Up @@ -2140,20 +2140,20 @@
"WebhookConfig": {
"examples": [
{
"host": "localhost",
"port": 50059,
"endpoints": [
{
"path": "/ingest",
"schema": {
"Inline": "\n {\n \"users\": {\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"id\",\n \"typ\": \"Int\",\n \"nullable\": false\n },\n {\n \"name\": \"name\",\n \"typ\": \"String\",\n \"nullable\": true\n },\n {\n \"name\": \"json\",\n \"typ\": \"Json\",\n \"nullable\": true\n }\n ]\n }\n }\n }\n "
},
"verbs": [
"POST",
"DELETE"
]
],
"schema": {
"Inline": "\n {\n \"users\": {\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"id\",\n \"typ\": \"Int\",\n \"nullable\": false\n },\n {\n \"name\": \"name\",\n \"typ\": \"String\",\n \"nullable\": true\n },\n {\n \"name\": \"json\",\n \"typ\": \"Json\",\n \"nullable\": true\n }\n ]\n }\n }\n }\n "
}
}
],
"host": "localhost",
"port": 50059
]
}
],
"type": "object",
Expand Down Expand Up @@ -2215,13 +2215,13 @@
"examples": [
{
"path": "/ingest",
"schema": {
"Inline": "\n {\n \"users\": {\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"id\",\n \"typ\": \"Int\",\n \"nullable\": false\n },\n {\n \"name\": \"name\",\n \"typ\": \"String\",\n \"nullable\": true\n },\n {\n \"name\": \"json\",\n \"typ\": \"Json\",\n \"nullable\": true\n }\n ]\n }\n }\n }\n "
},
"verbs": [
"POST",
"DELETE"
]
],
"schema": {
"Inline": "\n {\n \"users\": {\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"id\",\n \"typ\": \"Int\",\n \"nullable\": false\n },\n {\n \"name\": \"name\",\n \"typ\": \"String\",\n \"nullable\": true\n },\n {\n \"name\": \"json\",\n \"typ\": \"Json\",\n \"nullable\": true\n }\n ]\n }\n }\n }\n "
}
}
],
"type": "object",
Expand Down

0 comments on commit 3da183a

Please sign in to comment.