18.7 Load Data
Data Transforms allows you to directly load data from one system to another.
Create a file called load_data.py
in your project directory with the
following information.
Note:
You may need to change schema names based on your environment.
from datatransforms.workbench import DataTransformsWorkbench,WorkbenchConfig
from datatransforms.dataload import DataLoad
from datatransforms.project import Project
import logging
pswd="<your deployment pswd from secret store>"
connect_params = WorkbenchConfig.get_workbench_config(pswd)
workbench = DataTransformsWorkbench()
workbench.connect_workbench(connect_params)
prj = Project(name="MyProject")
####################################
# Delete the Project #
####################################
workbench.delete_project(prj)
####################################
# Create a Project #
####################################
project = Project("MyProject")
workbench.save_project(project)
####################################
# Create a Data Load #
####################################
dl = DataLoad("Load SH Data",project_name="MyProject")
dl.source("Demo Source Data.SH").\
recreate(table_name="COSTS").\
recreate(table_name="COUNTRIES").\
recreate(table_name="PRODUCTS").\
recreate(table_name="SUPPLEMENTARY_DEMOGRAPHICS").\
recreate(table_name="TIMES").\
recreate(table_name="CHANNELS").\
recreate(table_name="CUSTOMERS").\
recreate(table_name="PROMOTIONS").\
recreate(table_name="SALES").\
target("Demo Target Data.DEMO_TARGET")
dl.create_dataload()
You can navigate to the project in the Data Transforms UI and open the Data Load you just created and run it. Alternatively, you can add it to a Workflow and schedule it using the API.
Parent topic: Python API for Oracle Data Transforms