-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
WITH organization_apinvoice AS ( | ||
SELECT | ||
null AS _orgid, | ||
null AS businesspartner_id, | ||
null AS docreference, | ||
null AS invoice_id, | ||
null AS docissue, | ||
null AS erp_id, | ||
null AS protheus_id, | ||
null AS transactiontype, | ||
null AS deleted, | ||
null AS installmentqty | ||
--metadata-- | ||
FROM ( | ||
SELECT * EXCEPT(ranking) | ||
FROM ( | ||
SELECT ROW_NUMBER() OVER (partition BY mdmId ORDER BY mdmCounterForEntity DESC) ranking, * | ||
FROM stg_protheus_carol_organization | ||
--timestamp-- WHERE mdmCounterForEntity__DATETIME__ > SAFE.DATETIME(TIMESTAMP_MICROS(SAFE_CAST({{start_from}} AS INT64))) | ||
) | ||
WHERE ranking = 1 | ||
) AS stg | ||
), | ||
combinedSources AS ( | ||
SELECT * FROM organization_apinvoice | ||
), | ||
processedData AS ( | ||
SELECT * | ||
FROM combinedSources | ||
-- WHERE | ||
-- rejection rules | ||
) | ||
|
||
SELECT * FROM processedData | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters