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

Ensure correct field order in INSERT and implement order_id sequence functionality #201

Merged
merged 25 commits into from
Aug 2, 2017

Conversation

smgallo
Copy link
Contributor

@smgallo smgallo commented Aug 2, 2017

Ensure correct field order in INSERT and implement order_id sequence functionality for historical purposes.

Description

The field list for the INSERT must be in the same order as the fields returned by the query or we will get field mismatches. Use the source record fields (generated from the source query in initialize()) as the correct order. Since the destination field map may have been user-specified we cannot guarantee the order.

Some historical ingestors use an order_id and treat it similar to an auto-increment field, setting its value starting at 0 and incrementing for each record. It is not clear if this is used anywhere, but the functionality is maintained here for compatibility. Note that this does not work when adding fields into a table (e.g.,only when the table is truncated) and will not work properly in cases where the order is relative to a key. For example, if a key is resource_id and the order should be maintained for each unique resource_id we cannot use this method. To not overwrite existing data, only set the order_id if the source field exists and is NULL.

Motivation and Context

Fixes a bug where the INSERT INTO...SELECT field order for same-database inserts is not the same as the order of the fields in the SELECT.

Tests performed

Ran tests and performed sample ingestion.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@smgallo smgallo added bug Bugfixes enhancement Enhancement of the functionality of an existing feature Category:ETL Extract Transform Load labels Aug 2, 2017
@smgallo smgallo added this to the v7.0.0 milestone Aug 2, 2017
@smgallo smgallo requested a review from plessbd August 2, 2017 14:39
@@ -485,7 +496,7 @@ function ($s) {
$destColumnList
);
$updateColumns = implode(',', $updateColumnList);
$sql = "INSERT INTO $qualifiedDestTableName ($destColumns) " . $this->sourceQueryString
$sql = "INSERT INTO $qualifiedDestTableName\n($destColumns)\n" . $this->sourceQueryString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the mix of interpolation and not here is messing with my reading of this...

Copy link
Contributor

@plessbd plessbd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should some of these commits be squashed or not showing up...

@smgallo smgallo merged commit 4f32097 into ubccr:xdmod7.0 Aug 2, 2017
@smgallo smgallo deleted the etl/order_id branch August 2, 2017 15:21
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Sep 18, 2017
…functionality (ubccr#201)

* Ensure correct field order in INSERT. Implement order_id as sequence.
chakrabortyr pushed a commit to chakrabortyr/xdmod that referenced this pull request Oct 17, 2017
…functionality (ubccr#201)

* Ensure correct field order in INSERT. Implement order_id as sequence.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Jan 15, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Jan 15, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Feb 25, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Mar 31, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Mar 31, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
ryanrath pushed a commit to ryanrath/xdmod that referenced this pull request Jul 2, 2021
…urce

- Updated the url for the TreeGrid to point at `/etl/pipelines/actions`
- Upated the `getActionsforPipelines` method chain so that it produces output
  suitable for use in an ExtJS TreeGrid.
  - The change @ ubccr#201 was needed due to `get_object_vars` returning a keyed
    array `<property> => <value>`.
  - ubccr#289: This function preps the output for use use in an EXtJS TreeGrid.
  - ubccr#453: This was simplify / declutter the display of the action name from it's
    fully qualified form `xdmod.pipeline.action` to `action` as the nodes
    immediately preceeding the action node will already be displaying the full
    pipeline name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugfixes Category:ETL Extract Transform Load enhancement Enhancement of the functionality of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants