toluaina/pgsync

Support concat for children node fields

abdullah2993 opened this issue · 4 comments

It would be really nice if concat transform could support the ability to concat child columns in parent e.g.

 {
    "database": "postgres",
    "index": "products",
    "nodes": {
      "table": "products",
      "children": [
        {
          "table": "vendors",
          "label": "vendor",
          "columns": [
            "name"
          ],
          "relationship": {
            "variant": "object",
            "type": "one_to_one"
          }
        },
        {
          "table": "line_items",
          "label": "items",
          "columns": [
            "description"
          ],
          "relationship": {
            "variant": "object",
            "type": "one_to_many",
            "foreign_key": {
              "child": [
                "product_id"
              ],
              "parent": [
                "id"
              ]
            }
          }
        }
      ],
      "columns": [
        "number",
        "purchase_order",
        "sku",
        "quantity",
        "stock_date",
        "amount"
      ],
      "transform": {
        "concat": {
          "columns": [
            "number",
            "purchase_order",
            "billing_address",
            "email_addresses",
            "estimate_date",
            "amount",
            "items.description", <------ support this
            "vendor.name" <------ support this
          ],
          "destination": "global_search_field",
          "delimiter": " "
        }
      }
    }
  }

support concating items.description and vendor.name in the given sample

I get what you mean. That could get complicated in generalised cases though. e.g if the parent had multiple children then you need to specify in index to concat.

I'm not sure if I understand the question.

@toluaina It would be very interesting in cases of having a one_by_one relationship type to avoid and filter situations with multiple results. Is this issue still open, or is this other implementation for pgsync in some version snapshot? Is there a repository of plugins where I can find something similar? Thank you very much.