{
    "name": "pl_full_load_step",
    "objectId": "467eb54a-603c-494e-b58f-7a5618bc6580",
    "properties": {
        "description": "for a given meta data record, execute a full load copy (sql server) to (fabric wh).",
        "activities": [
            {
                "name": "act_gen_script_log_start",
                "description": "log start of job",
                "type": "Script",
                "dependsOn": [],
                "policy": {
                    "timeout": "0.0:10:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "linkedService": {
                    "name": "dw_advwrks_analytics",
                    "properties": {
                        "annotations": [],
                        "type": "DataWarehouse",
                        "typeProperties": {
                            "endpoint": "abgrhetr4hsurajv2abiablt4q-xhy3b4ru6tmund3uxsmf3ljbim.datawarehouse.fabric.microsoft.com",
                            "artifactId": "f6c5e56f-7697-4347-93b3-af9d31acd85f",
                            "workspaceId": "f2b0f1b9-f434-46d9-8f74-bc985dad2143"
                        }
                    }
                },
                "typeProperties": {
                    "scripts": [
                        {
                            "type": "Query",
                            "text": {
                                "value": "@concat('insert into meta.Logs ( [job_id], [step_id], [program_name], [step_description], [action_type], [additional_info], [action_timestamp] ) values( ', pipeline().parameters.meta_data.job_id, ', ', pipeline().parameters.meta_data.step_id, ', ''', pipeline().PipelineName, ''', ''', pipeline().parameters.meta_data.step_description, ''', ''start pipeline''', ', ''none'', ', 'getdate()', ' );')",
                                "type": "Expression"
                            }
                        }
                    ],
                    "scriptBlockExecutionTimeout": "02:00:00"
                }
            },
            {
                "name": "act_gen_script_log_end",
                "description": "log end of job",
                "type": "Script",
                "dependsOn": [
                    {
                        "activity": "act_mt_cpy_sqlsvr_to_fabric",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "policy": {
                    "timeout": "0.0:10:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "linkedService": {
                    "name": "dw_advwrks_analytics",
                    "properties": {
                        "annotations": [],
                        "type": "DataWarehouse",
                        "typeProperties": {
                            "endpoint": "abgrhetr4hsurajv2abiablt4q-xhy3b4ru6tmund3uxsmf3ljbim.datawarehouse.fabric.microsoft.com",
                            "artifactId": "f6c5e56f-7697-4347-93b3-af9d31acd85f",
                            "workspaceId": "f2b0f1b9-f434-46d9-8f74-bc985dad2143"
                        }
                    }
                },
                "typeProperties": {
                    "scripts": [
                        {
                            "type": "Query",
                            "text": {
                                "value": "@concat('insert into meta.Logs ( [job_id], [step_id], [program_name], [step_description], [action_type], [additional_info], [action_timestamp] ) values( ', pipeline().parameters.meta_data.job_id, ', ', pipeline().parameters.meta_data.step_id, ', ''', pipeline().PipelineName, ''', ''', pipeline().parameters.meta_data.step_description, ''', ''end pipeline'', ''', activity('act_mt_cpy_sqlsvr_to_fabric').output.RowsCopied, ' records copied'', ', 'getdate()', ' );')",
                                "type": "Expression"
                            }
                        }
                    ],
                    "scriptBlockExecutionTimeout": "02:00:00"
                }
            },
            {
                "name": "act_gen_script_log_failure",
                "description": "log failure of job",
                "type": "Script",
                "dependsOn": [
                    {
                        "activity": "act_mt_cpy_sqlsvr_to_fabric",
                        "dependencyConditions": [
                            "Failed"
                        ]
                    }
                ],
                "policy": {
                    "timeout": "0.0:10:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "linkedService": {
                    "name": "dw_advwrks_analytics",
                    "properties": {
                        "annotations": [],
                        "type": "DataWarehouse",
                        "typeProperties": {
                            "endpoint": "abgrhetr4hsurajv2abiablt4q-xhy3b4ru6tmund3uxsmf3ljbim.datawarehouse.fabric.microsoft.com",
                            "artifactId": "f6c5e56f-7697-4347-93b3-af9d31acd85f",
                            "workspaceId": "f2b0f1b9-f434-46d9-8f74-bc985dad2143"
                        }
                    }
                },
                "typeProperties": {
                    "scripts": [
                        {
                            "type": "Query",
                            "text": {
                                "value": "@concat('insert into meta.Logs ( [job_id], [step_id], [program_name], [step_description], [action_type], [additional_info], [action_timestamp] ) values( ', pipeline().parameters.meta_data.job_id, ', ', pipeline().parameters.meta_data.step_id, ', ''', pipeline().PipelineName, ''', ''', pipeline().parameters.meta_data.step_description, ''', ''fail pipeline'', ''', replace(activity('act_mt_cpy_sqlsvr_to_fabric').error.Message, '''', ''), ''', ', 'getdate()', ' );')",
                                "type": "Expression"
                            }
                        }
                    ],
                    "scriptBlockExecutionTimeout": "02:00:00"
                }
            },
            {
                "name": "act_mt_cpy_sqlsvr_to_fabric",
                "description": "Copy table data from Azure SQL database to Fabric warehouse.",
                "type": "Copy",
                "dependsOn": [
                    {
                        "activity": "act_gen_script_log_start",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "policy": {
                    "timeout": "0.12:00:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "typeProperties": {
                    "source": {
                        "type": "AzureSqlSource",
                        "queryTimeout": "02:00:00",
                        "partitionOption": "None",
                        "datasetSettings": {
                            "annotations": [],
                            "type": "AzureSqlTable",
                            "schema": [],
                            "typeProperties": {
                                "schema": {
                                    "value": "@pipeline().parameters.meta_data.src_schema",
                                    "type": "Expression"
                                },
                                "table": {
                                    "value": "@pipeline().parameters.meta_data.src_table",
                                    "type": "Expression"
                                },
                                "database": "AdventureWorksLT2012"
                            },
                            "externalReferences": {
                                "connection": "67d9bf04-683b-41fd-968b-226db1dd5748"
                            }
                        }
                    },
                    "sink": {
                        "type": "DataWarehouseSink",
                        "preCopyScript": {
                            "value": "@concat('truncate table ', pipeline().parameters.meta_data.dst_schema, '.', pipeline().parameters.meta_data.dst_table)",
                            "type": "Expression"
                        },
                        "allowCopyCommand": true,
                        "datasetSettings": {
                            "annotations": [],
                            "linkedService": {
                                "name": "dw_advwrks_analytics",
                                "properties": {
                                    "annotations": [],
                                    "type": "DataWarehouse",
                                    "typeProperties": {
                                        "endpoint": "abgrhetr4hsurajv2abiablt4q-xhy3b4ru6tmund3uxsmf3ljbim.datawarehouse.fabric.microsoft.com",
                                        "artifactId": "f6c5e56f-7697-4347-93b3-af9d31acd85f",
                                        "workspaceId": "f2b0f1b9-f434-46d9-8f74-bc985dad2143"
                                    }
                                }
                            },
                            "type": "DataWarehouseTable",
                            "schema": [],
                            "typeProperties": {
                                "schema": {
                                    "value": "@pipeline().parameters.meta_data.dst_schema",
                                    "type": "Expression"
                                },
                                "table": {
                                    "value": "@pipeline().parameters.meta_data.dst_table",
                                    "type": "Expression"
                                }
                            }
                        }
                    },
                    "enableStaging": true,
                    "translator": {
                        "type": "TabularTranslator",
                        "typeConversion": true,
                        "typeConversionSettings": {
                            "allowDataTruncation": true,
                            "treatBooleanAsNumber": false
                        }
                    }
                }
            }
        ],
        "parameters": {
            "meta_data": {
                "type": "object",
                "defaultValue": {
                    "row_id": 3,
                    "job_id": 2,
                    "step_id": 1,
                    "step_description": "Daily full load for table SalesLT.Address",
                    "load_type": "full",
                    "src_type": "IaaS - SQL Server 2022",
                    "src_database": "AdventureWorksLT2012",
                    "src_schema": "SalesLT",
                    "src_table": "Address",
                    "src_query": "select * from SalesLT.Address",
                    "dst_type": "PaaS - Fabric Data Warehouse",
                    "dst_database": "dw_advwrks_analytic",
                    "dst_schema": "raw",
                    "dst_table": "Address",
                    "is_enabled": true
                }
            }
        },
        "lastModifiedByObjectId": "7559da66-430f-46eb-9c36-f968676fabbf",
        "lastPublishTime": "2025-03-10T19:38:51Z"
    }
}