Carol shouldn't allow to create the field _ingestionDatetime on staging tables and data models

Description

Issue Component(s) on Oct 26, 2023, 11:53:42 PM: CONNECTOR | DATA_INGESTION

PRDE - Story default text according to the team DoR (Definition of Ready)

02 - PROBLEM (WHAT'S THE CURRENT PROBLEM SCENARIO OR PAIN TO BE RESOLVED?):

Today the user can send data with the field _ingestionDatetime and it forces Carol to create the field.

https://poffo.carol.ai/clockintestweb/carol-ui/connectors/clockinmobile/employee?p=1&ps=25&order=ASC&filters=%5B%7B%22consolidation%22:%22n%22%7D%5D

The task to update the schema fails, but it is not needed to work properly on the schema on staging area is already defined:

https://poffo.carol.ai/clockintestweb/carol-ui/tasks/activity/5ebbed8c73884d6983216bbf6fc12b5a?p=1&ps=25&sort=dateUpdated&order=DESC&filters=%5B%7B%22hideInternal%22:%22false%22%7D%5D

It accept the record and define the value as we can see here:

06 - ACCEPTANCE CRITERIA:

  • Do not allow users to create the field _ingestionDatetime on staging tables and data models. It should consider the following flows:
    • PUT staging schema
    • POST staging schema.
    • Send data to a flexible staging table.

Ps.: The Issue

will allow as an exception the role Carol Admin to send data (not change the staging table schema) and send data to the field _ingestionDatetime.

Activity

Automation for Jira 14 December 2023, 20:25 Jira Internal Users

This issue was automatically transitioned to REGRESSION, as its PR was just merged into qa branch in Github.

Automation for Jira 14 December 2023, 20:25 Jira Internal Users

This issue was automatically transitioned to REGRESSION, as its PR was just merged into qa branch in Github.

Automation for Jira 14 December 2023, 20:25 Jira Internal Users

This issue was automatically transitioned to REGRESSION, as its PR was just merged into qa branch in Github.

Automation for Jira 14 December 2023, 20:25 Jira Internal Users

This issue was automatically transitioned to REGRESSION, as its PR was just merged into qa branch in Github.

Automation for Jira 14 December 2023, 20:25 Jira Internal Users

This issue was automatically transitioned to REGRESSION, as its PR was just merged into qa branch in Github.

Automation for Jira 14 December 2023, 19:46 Jira Internal Users

This issue was automatically transitioned to TESTED & MERGED, as its PR was just merged into develop branch in Github. PR Approved by rfschroeder,douglascoimbra.

Automation for Jira 14 December 2023, 19:45 Jira Internal Users

Github user douglascoimbra has just approved a PR (added as Shard Assignee in this Jira issue).

feat: features to _ingestionDatetime at staging schema

Automation for Jira 14 December 2023, 19:44 Jira Internal Users

This issue was automatically transitioned to QA REVIEW, as its PR was just approved in Github.

Automation for Jira 14 December 2023, 19:44 Jira Internal Users

This issue was automatically transitioned to QA REVIEW, as its PR was just approved in Github.

Douglas Coimbra Lopes 13 December 2023, 14:11 Jira Internal Users

@André Pereira de Oliveira Card was revalidated by the QA team, it is pending the code review. cc @Gabriel DAmore Marciano

Douglas Coimbra Lopes 13 December 2023, 14:10 Jira Internal Users

INGESTION DATE TIME BLOCKED FOR DATA MODELS

SNAPSHOT ALSO BEING BLOCKED

Automation for Jira 12 December 2023, 21:14 Jira Internal Users

This issue was automatically transitioned to REVIEW, as its PR (not DRAFT and not WIP) was just created in Github.

feat: features to _ingestionDatetime at staging schema

Automation for Jira 12 December 2023, 15:41 Jira Internal Users

Github user rfschroeder has just approved a PR (added as Shard Assignee in this Jira issue).

feat: features to _ingestionDatetime at staging schema

Automation for Jira 12 December 2023, 15:38 Jira Internal Users

Github user douglascoimbra has just approved a PR (added as Shard Assignee in this Jira issue).

feat: features to _ingestionDatetime at staging schema

Automation for Jira 12 December 2023, 15:36 Jira Internal Users

This issue was automatically transitioned to QA REVIEW, as its PR was just approved in Github.

Douglas Coimbra Lopes 11 December 2023, 22:00 Jira Internal Users

@Gabriel DAmore Marciano @André Pereira de Oliveira This card has been validated by the QA team. It is pending only the code review

Automation for Jira 11 December 2023, 20:26 Jira Internal Users

@Robson Thanael Poffo ,
@Pedro Buzzi , @André Pereira de Oliveira , @Douglas Coimbra Lopes , @Gabriel DAmore Marciano , @Reinaldo Oliveira Machado Junior

This issue was planned to be delivered until 2024-01-01. You can check that by consulting the issue in the Due Date field.

Dates already planned for this issue: 2023-11-20, 2023-12-11, 2024-01-01

If External Issue Link field is filled, customer was also informed on JIRA TOTVS.

Automation for Jira 8 December 2023, 22:32 Jira Internal Users

This issue was automatically transitioned to REVIEW, as its PR (not DRAFT and not WIP) was just created in Github.

feat: features to _ingestionDatetime at staging schema

Gabriel DAmore Marciano 8 December 2023, 15:36 Jira Internal Users

Flag removed

Dev working on the fix

Automation for Jira 8 December 2023, 14:53 Jira Internal Users

This issue was automatically transitioned to QA REVIEW, as its PR was just approved in Github.

Douglas Coimbra Lopes 7 December 2023, 20:46 Jira Internal Users

BLOCKING INTAKE FOR FLEXIBLE SCHEMA

BLOCKING STAGING SCHEMA CREATION

BLOCKING UPDATE SCHEMA

BLOCKING SNAPSHOT

UI

Automation for Jira 7 December 2023, 13:28 Jira Internal Users

This issue was automatically transitioned to REVIEW, as its PR (not DRAFT and not WIP) was just created in Github.

feat: features to _ingestionDatetime at staging schema

Automation for Jira 5 December 2023, 13:36 Jira Internal Users

@Robson Thanael Poffo ,
@André Pereira de Oliveira , @Douglas Coimbra Lopes

Flag was removed since you have just transitioned the issue status/column.

Automation for Jira 4 December 2023, 20:08 Jira Internal Users

This issue was automatically transitioned to REVIEW, as its PR (not DRAFT and not WIP) was just created in Github.

feat: features to _ingestionDatetime at staging schema

Gabriel DAmore Marciano 4 December 2023, 15:54 Jira Internal Users

Flag added

Question related to V2 tables are existing _ingestionDatetime column

Automation for Jira 4 December 2023, 14:48 Jira Internal Users

estou com uma dúvida no card , caso já ocorreu o update da staging schema (ou via intake) adicionando a coluna `_ingestionDatetime`. Qual é o comportamento esperado para os próximos updates?

cc:

Sent by Slack - pm-backend - André Oliveira

Automation for Jira 4 December 2023, 14:43 Jira Internal Users

@Robson Thanael Poffo ,
@André Pereira de Oliveira , @Douglas Coimbra Lopes

Flag was removed since you have just transitioned the issue status/column.

Douglas Coimbra Lopes 25 November 2023, 16:41 Jira Internal Users

@André Pereira de Oliveira TETSFAILED

  • Scenario: It is possible to create the _ingestionDateTime field on the staging table by updating an existing staging schema.

  • Staging on this test: emitente_1

  • CURL:

  • 1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    curl -X 'PUT' \
      'https://totvsdatastomach.qarol.ai/api/v3/staging/tables/emitente_1/schema?connectorId=71883a8e16644e11959762cd2d4a5f7e' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: Bearer 8508544d579742f78674ed8d12429b84' \
      -d '{
      "mdmSchemaMapping": {
        "mdmProperties": {
          "_ingestionDatetime": {
            "mdmType": "date"
          },
          "id": {
            "mdmType": "string",
            "mdmHidden": false
          },
          "name": {
            "mdmType": "string",
            "mdmHidden": false
          },
          "phone": {
            "mdmType": "nested",
            "mdmHidden": false
          }
        },
        "mdmHidden": false,
        "mdmPropertyOrdering": [
          "phone",
          "name",
          "id"
        ]
      },
      "mdmStagingMapping": {
        "properties": {
          "newfield": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "nested"
          }
        }
      },
      "mdmCrosswalkTemplate": {
        "mdmCrossreference": {
          "emitente_1": [
            "id"
          ]
        }
      }
    }'
Douglas Coimbra Lopes 25 November 2023, 16:39 Jira Internal Users

BLOCKING INGESTION DATETIME ON STAGING SCHEMA CREATION: PASSED

UPDATING STAGING SCHEMA

BLOCKING STAGING SCHEMA UPLOAD SNAPSHOT

Automation for Jira 25 November 2023, 00:46 Jira Internal Users

This issue was automatically transitioned to REVIEW, as its PR (not DRAFT and not WIP) was just created in Github.

feat: features to _ingestionDatetime at staging schema

Automation for Jira 20 November 2023, 20:12 Jira Internal Users

@Robson Thanael Poffo ,
@Geny Isam Hamud Herrera ,

This issue was planned to be delivered until 2023-12-11. You can check that by consulting the issue in the Due Date field.

Dates already planned for this issue: 2023-11-20, 2023-12-11

If External Issue Link field is filled, customer was also informed on JIRA TOTVS.

Automation for Jira 30 October 2023, 20:33 Jira Internal Users

@Robson Thanael Poffo ,
@Geny Isam Hamud Herrera ,

This issue was planned to be delivered until 2023-11-20. You can check that by consulting the issue in the Due Date field.

Dates already planned for this issue: 2023-11-20

If External Issue Link field is filled, customer was also informed on JIRA TOTVS.

Robson Thanael Poffo 28 October 2023, 01:38 Jira Internal Users
  • In case the request to send data, for any role (except carol admin) send the field _ingestionDatetime, the value should be ignored.

    • Staging table without flexible schema

    • Staging table with flexible schema

Robson Thanael Poffo 28 October 2023, 01:37 Jira Internal Users

@Geny Isam Hamud Herrera , the behavior today is that we just ignore the attributes.

I tested the following flows:

  • sent mdmConnector: it was overrided by the default connectorID defined on the request.

  • sent mdmConnectorIdpppp: it was ignored instead of create the new field.

So, to avoid any issue by connectors sending data using reserved fields (ignored today), we should keep ignoring them.

Geny Isam Hamud Herrera 27 October 2023, 20:40 Jira Internal Users

Flag added

@Robson Thanael Poffo how do you want us to handle the staging flexible for reserved names. Just ignore the attribute reserved or throw an error message?

Robson Thanael Poffo 27 October 2023, 16:06 Jira Internal Users

Today only two tenant has this field created, the one that belongs to Danilo and the one I explored to validate this scenario:

1

2

3

4

5

 
  
select *
from (select * from `carol-da1c1280ac9b11e68e25.da1c1280ac9b11e68e250401f8d88501.ingestion_stg_fluigdata_stagingtabledata` where captureDate = (select max(captureDate) from `carol-da1c1280ac9b11e68e25.da1c1280ac9b11e68e250401f8d88501.ingestion_stg_fluigdata_stagingtabledata`)) st, unnest((JSON_EXTRACT_ARRAY(fieldsArray, '$.'))) fieldsArray
where lower(JSON_VALUE(fieldsArray, "$.key")) = lower('_ingestionDatetime')
limit 100