From fd0dfcce1c1218a03ef48a3fc05dc3a880bc0c9b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 26 Mar 2024 13:59:22 +0700 Subject: add product category parent id in product data warehouse --- import_product_product.ktr | 18 +- import_product_product_one_time.ktr | 929 ++++++++++++++++++++++++++++++++++++ run_single_ktr.sh | 2 +- 3 files changed, 945 insertions(+), 4 deletions(-) create mode 100644 import_product_product_one_time.ktr diff --git a/import_product_product.ktr b/import_product_product.ktr index 0942694..afdc987 100644 --- a/import_product_product.ktr +++ b/import_product_product.ktr @@ -558,12 +558,19 @@ erp indoteknik production (localhost) select pp.id as product_id, pt.id as template_id, pt.name, pp.active::boolean, pt.x_manufacture as brand_id, case when pp.default_code is null then pt.default_code else pp.default_code end as item_code, -(select name from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category +( + select name from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr - where ppcptr.product_template_id = pt.id limit 1)))) as parent_category, + where ppcptr.product_template_id = pt.id limit 1))) +) as parent_category, (select store_fname from ir_attachment ia where ia.res_model='product.template' and res_field='image_1920' and ia.res_id=pt.id) as image, pt.website_description as description, -pt.weight +pt.weight, +( + select ppc.id from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category + where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr + where ppcptr.product_template_id = pt.id limit 1))) +) as parent_category_id from product_product pp join product_template pt on pt.id = pp.product_tmpl_id where pp.write_date >= (now() - '5 days'::interval) @@ -892,6 +899,11 @@ where pp.write_date >= (now() - '5 days'::interval) weight Y + + parent_category_id + parent_category_id + Y + diff --git a/import_product_product_one_time.ktr b/import_product_product_one_time.ktr new file mode 100644 index 0000000..d2839bb --- /dev/null +++ b/import_product_product_one_time.ktr @@ -0,0 +1,929 @@ + + + + import_product_product_one_time + + + + Normal + 0 + / + + + + + + + + + + + + ID_BATCH + Y + ID_BATCH + + + CHANNEL_ID + Y + CHANNEL_ID + + + TRANSNAME + Y + TRANSNAME + + + STATUS + Y + STATUS + + + LINES_READ + Y + LINES_READ + + + + LINES_WRITTEN + Y + LINES_WRITTEN + + + + LINES_UPDATED + Y + LINES_UPDATED + + + + LINES_INPUT + Y + LINES_INPUT + + + + LINES_OUTPUT + Y + LINES_OUTPUT + + + + LINES_REJECTED + Y + LINES_REJECTED + + + + ERRORS + Y + ERRORS + + + STARTDATE + Y + STARTDATE + + + ENDDATE + Y + ENDDATE + + + LOGDATE + Y + LOGDATE + + + DEPDATE + Y + DEPDATE + + + REPLAYDATE + Y + REPLAYDATE + + + LOG_FIELD + Y + LOG_FIELD + + + EXECUTING_SERVER + N + EXECUTING_SERVER + + + EXECUTING_USER + N + EXECUTING_USER + + + CLIENT + N + CLIENT + + + + + +
+ + + + ID_BATCH + Y + ID_BATCH + + + SEQ_NR + Y + SEQ_NR + + + LOGDATE + Y + LOGDATE + + + TRANSNAME + Y + TRANSNAME + + + STEPNAME + Y + STEPNAME + + + STEP_COPY + Y + STEP_COPY + + + LINES_READ + Y + LINES_READ + + + LINES_WRITTEN + Y + LINES_WRITTEN + + + LINES_UPDATED + Y + LINES_UPDATED + + + LINES_INPUT + Y + LINES_INPUT + + + LINES_OUTPUT + Y + LINES_OUTPUT + + + LINES_REJECTED + Y + LINES_REJECTED + + + ERRORS + Y + ERRORS + + + INPUT_BUFFER_ROWS + Y + INPUT_BUFFER_ROWS + + + OUTPUT_BUFFER_ROWS + Y + OUTPUT_BUFFER_ROWS + + + + + +
+ + + ID_BATCH + Y + ID_BATCH + + + CHANNEL_ID + Y + CHANNEL_ID + + + LOG_DATE + Y + LOG_DATE + + + LOGGING_OBJECT_TYPE + Y + LOGGING_OBJECT_TYPE + + + OBJECT_NAME + Y + OBJECT_NAME + + + OBJECT_COPY + Y + OBJECT_COPY + + + REPOSITORY_DIRECTORY + Y + REPOSITORY_DIRECTORY + + + FILENAME + Y + FILENAME + + + OBJECT_ID + Y + OBJECT_ID + + + OBJECT_REVISION + Y + OBJECT_REVISION + + + PARENT_CHANNEL_ID + Y + PARENT_CHANNEL_ID + + + ROOT_CHANNEL_ID + Y + ROOT_CHANNEL_ID + + + + + +
+ + + ID_BATCH + Y + ID_BATCH + + + CHANNEL_ID + Y + CHANNEL_ID + + + LOG_DATE + Y + LOG_DATE + + + TRANSNAME + Y + TRANSNAME + + + STEPNAME + Y + STEPNAME + + + STEP_COPY + Y + STEP_COPY + + + LINES_READ + Y + LINES_READ + + + LINES_WRITTEN + Y + LINES_WRITTEN + + + LINES_UPDATED + Y + LINES_UPDATED + + + LINES_INPUT + Y + LINES_INPUT + + + LINES_OUTPUT + Y + LINES_OUTPUT + + + LINES_REJECTED + Y + LINES_REJECTED + + + ERRORS + Y + ERRORS + + + LOG_FIELD + N + LOG_FIELD + + + + + +
+ + + ID_BATCH + Y + ID_BATCH + + + CHANNEL_ID + Y + CHANNEL_ID + + + LOG_DATE + Y + LOG_DATE + + + METRICS_DATE + Y + METRICS_DATE + + + METRICS_CODE + Y + METRICS_CODE + + + METRICS_DESCRIPTION + Y + METRICS_DESCRIPTION + + + METRICS_SUBJECT + Y + METRICS_SUBJECT + + + METRICS_TYPE + Y + METRICS_TYPE + + + METRICS_VALUE + Y + METRICS_VALUE + + + + + +
+ + 0.0 + 0.0 + + 10000 + 50 + 50 + N + Y + 50000 + Y + + N + 1000 + 100 + + + + + + + + + - + 2023/08/09 16:13:00.056 + - + 2023/08/09 16:13:00.056 + H4sIAAAAAAAAAAMAAAAAAAAAAAA= + N + + + + + dw bi indoteknik (localhost) + localhost + POSTGRESQL + Native + dw_bi_indoteknik + 5432 + odoo + Encrypted 2be98afc82bdfd8dd9a2ca45acc83f6c3 + + + + + + FORCE_IDENTIFIERS_TO_LOWERCASE + N + + + FORCE_IDENTIFIERS_TO_UPPERCASE + N + + + IS_CLUSTERED + N + + + PORT_NUMBER + 5432 + + + PRESERVE_RESERVED_WORD_CASE + Y + + + QUOTE_ALL_FIELDS + N + + + SUPPORTS_BOOLEAN_DATA_TYPE + Y + + + SUPPORTS_TIMESTAMP_DATA_TYPE + N + + + USE_POOLING + N + + + + + erp indoteknik production (localhost) + 10.148.0.3 + POSTGRESQL + Native + erp_indoteknik + 5432 + odoo + Encrypted 2be98afc82bdfd8dd9a2ca45acc83f6c3 + + + + + + FORCE_IDENTIFIERS_TO_LOWERCASE + N + + + FORCE_IDENTIFIERS_TO_UPPERCASE + N + + + IS_CLUSTERED + N + + + PORT_NUMBER + 5432 + + + PRESERVE_RESERVED_WORD_CASE + Y + + + QUOTE_ALL_FIELDS + N + + + SUPPORTS_BOOLEAN_DATA_TYPE + Y + + + SUPPORTS_TIMESTAMP_DATA_TYPE + N + + + USE_POOLING + N + + + + + + Table input + dw Insert / update product + Y + + + + Table input + TableInput + + Y + + 1 + + none + + + erp indoteknik production (localhost) + select pp.id as product_id, pt.id as template_id, pt.name, pp.active::boolean, pt.x_manufacture as brand_id, +case when pp.default_code is null then pt.default_code else pp.default_code end as item_code, +( + select name from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category + where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr + where ppcptr.product_template_id = pt.id limit 1))) +) as parent_category, +(select store_fname from ir_attachment ia where ia.res_model='product.template' and res_field='image_1920' and ia.res_id=pt.id) as image, +pt.website_description as description, +pt.weight, +( + select ppc.id from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category + where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr + where ppcptr.product_template_id = pt.id limit 1))) +) as parent_category_id +from product_product pp +join product_template pt on pt.id = pp.product_tmpl_id +--where pp.write_date >= (now() - '5 days'::interval) + 0 + + N + N + N + N + + + Integer + normal + product_id + 9 + 0 + Table input + product_id + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Integer + normal + template_id + 9 + 0 + Table input + template_id + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal + name + 2147483647 + -1 + Table input + name + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Boolean + normal + active + -1 + -1 + Table input + active + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Integer + normal + brand_id + 9 + 0 + Table input + brand_id + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal + item_code + 2147483647 + -1 + Table input + item_code + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal + parent_category + 2147483647 + -1 + Table input + parent_category + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal + image + 2147483647 + -1 + Table input + image + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal + description + 2147483647 + -1 + Table input + description + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + BigNumber + normal + weight + -1 + -1 + Table input + weight + ######0.0###################;-######0.0################### + . + + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + + + + + + + + + + 288 + 128 + Y + + + + dw Insert / update product + InsertUpdate + + Y + + 1 + + none + + + dw bi indoteknik (localhost) + 100 + N + + public +
product
+ + product_id + product_id + = + + + + product_id + product_id + N + + + template_id + template_id + Y + + + name + name + Y + + + active + active + Y + + + brand_id + brand_id + Y + + + item_code + item_code + Y + + + parent_category + parent_category + Y + + + image + image + Y + + + description + description + Y + + + weight + weight + Y + + + parent_category_id + parent_category_id + Y + + + + + + + + + + + + 448 + 128 + Y + + + + + + + N + +
diff --git a/run_single_ktr.sh b/run_single_ktr.sh index 3b6fa27..a30d397 100644 --- a/run_single_ktr.sh +++ b/run_single_ktr.sh @@ -1 +1 @@ -sh /home/stephan/data-integration/pan.sh -level="Debug" -file="/home/stephan/transformation-job-bi/update_brand_purchase_pricelist_dw.ktr" > "/home/stephan/transformation-job-bi/log/run_single_ktr.log" +sh /home/stephan/data-integration/pan.sh -level="Debug" -file="/home/stephan/transformation-job-bi/import_product_product_one_time.ktr" > "/home/stephan/transformation-job-bi/log/run_single_ktr.log" -- cgit v1.2.3