Skip to content

Commit

Permalink
add placeholder for relational.lookup block (#364)
Browse files Browse the repository at this point in the history
* add placeholder for relational.lookup block

* update json schemas

* update autogenerated docs

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
zalmane and github-actions authored May 16, 2024
1 parent d71e32c commit f7aa537
Show file tree
Hide file tree
Showing 4 changed files with 968 additions and 743 deletions.
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

0 comments on commit f7aa537

Please sign in to comment.