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

add placeholder for relational.lookup block #364

Merged
merged 3 commits into from
May 16, 2024
Merged
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
Empty file.
71 changes: 71 additions & 0 deletions core/src/datayoga_core/blocks/relational/lookup/block.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"title": "relational.write",
"description": "Lookup in a relational table",
"type": "object",
"additionalProperties": false,
"examples": [
{
"id": "load_snowflake",
"type": "relational.write",
"properties": {
"connection": "eu_datalake",
"table": "employees",
"schema": "dbo",
"load_strategy": "APPEND"
}
}
],
"properties": {
"condition": {
"type": "string",
"title": "The lookup condition",
"description": "Use any valid SQL syntax. Use the alias `lookup` for the lookup table and `incoming` for the base table",
"examples": ["lookup.account_number = incoming.i_acct_no"]
},
"query": {
"type": "string",
"title": "Query string to use as an override to the built in query",
"description": "Use any valid SQL syntax. Use the alias `lookup` for the lookup table and `incoming` for the base table",
"examples": [
"select country_code,country_name from countries where is_active=1"
]
},
"schema": {
"type": "string",
"title": "The table schema of the lookup table",
"description": "If not specified, no specific schema will be used when connecting to the database.",
"examples": ["dbo"]
},
"table": {
"type": "string",
"title": "The lookup table name",
"description": "Lookup table name",
"examples": ["countries"]
},
"order_by": {
"type": "array",
"title": "List of keys to use for ordering. Applicable for multiple matches",
"items": {
"type": ["string"],
"title": "name of column"
},
"examples": [["country_name"]]
},
"fields": {
"type": "array",
"title": "Columns to add to the output from the lookup table",
"items": {
"type": ["string", "object"],
"title": "name of column"
},
"examples": [["fname", { "lname": "last_name" }, "address", "gender"]]
},
"multiple_match_policy": {
"type": "string",
"enum": ["first", "last", "all"],
"description": "How to handle multiple matches in the lookup table",
"default": ""
}
},
"required": []
}
67 changes: 67 additions & 0 deletions docs/reference/blocks/relational_lookup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
parent: Blocks
grand_parent: Reference
---

# relational\.write

Lookup in a relational table


**Properties**

|Name|Type|Description|Required|
|----|----|-----------|--------|
|**condition**<br/>(The lookup condition)|`string`|Use any valid SQL syntax. Use the alias `lookup` for the lookup table and `incoming` for the base table<br/>|no|
|**query**<br/>(Query string to use as an override to the built in query)|`string`|Use any valid SQL syntax. Use the alias `lookup` for the lookup table and `incoming` for the base table<br/>|no|
|**schema**<br/>(The table schema of the lookup table)|`string`|If not specified, no specific schema will be used when connecting to the database.<br/>|no|
|**table**<br/>(The lookup table name)|`string`|Lookup table name<br/>|no|
|[**order\_by**](#order_by)<br/>(List of keys to use for ordering\. Applicable for multiple matches)|`array`||no|
|[**fields**](#fields)<br/>(Columns to add to the output from the lookup table)|`array`||no|
|**multiple\_match\_policy**|`string`|How to handle multiple matches in the lookup table<br/>Default: `""`<br/>Enum: `"first"`, `"last"`, `"all"`<br/>|no|

**Additional Properties:** not allowed
**Example**

```yaml
id: load_snowflake
type: relational.write
properties:
connection: eu_datalake
table: employees
schema: dbo
load_strategy: APPEND

```

<a name="order_by"></a>
## order\_by\[\]: List of keys to use for ordering\. Applicable for multiple matches

**Items: name of column**

**Item Type:** `string`
**Example**

```yaml
- country_name

```

<a name="fields"></a>
## fields\[\]: Columns to add to the output from the lookup table

**Items: name of column**

**No properties.**

**Example**

```yaml
- fname
- lname: last_name
- address
- gender

```


Loading