extra SQL tables

Shahin Mortazave 491 Reputation points
2021-02-05T12:43:18.487+00:00

Hi,

Is it possible to add more tables to an existing datasets in Azure data factory?
We have a pipeline that copy some on perm SQL tables to the Azure DB and everything works, but now I want to add some more tables to the data sets but dont see any option for this.
Any suggestion?

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,222 questions
{count} votes

Accepted answer
  1. Nasreen Akter 10,791 Reputation points
    2021-02-10T15:36:27.287+00:00

    Hi @Shahin Mortazave ,

    If you want to pull data into Azure SQL DB for a specific range, you have to create do the following:

    1. create Datasets for your on-prem SQL table + your Azure SQL Table
    2. create a pipeline with two parameters pullDataFrom and pullDataTo
    3. add a CopyActivity into the pipeline where source --> Dataset_onPrem_Table and sink --> Dataset_Destination_Table
    4. now, in the CopyActivity > source --> select Query option and write your select statement there. @markus.bohland@hotmail.de ('SELECT * FROM Table1 WHERE FORMAT(CREATION_DATE, ''yyyy-MM-dd HH:mm:ss'') >= ''', pipeline().parameters.pullDataFrom,
      ''' AND FORMAT(CREATION_DATE, ''yyyy-MM-dd HH:mm:ss'') <''', pipeline().parameters.pullDataTo,'''')
    5. before pulling data on schedule, run the pipeline to pull and load all the records to the Azure SQL Table by widen the pullDataFrom and pullDataTo date until your schedule the pipeline.
    6. in the trigger, you can use the following expression to dynamically generate the daterange e.g., @markus.bohland@hotmail.de (formatDateTime(adddays(utcnow(), -1), 'yyyy-MM-dd'), ' 00:00:00')
      @markus.bohland@hotmail.de (formatDateTime(utcnow(), 'yyyy-MM-dd'), ' 00:00:00')

    Please see the screenshots for details:

    66574-image-2.jpg
    66651-image-1.jpg
    66623-image-3.jpg
    66575-image-4.jpg

    ----------

    If the above response is helpful, please accept as answer and up-vote it. Thanks!

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Nasreen Akter 10,791 Reputation points
    2021-02-05T14:37:45.057+00:00

    Hi @Shahin Mortazave ,

    In the Azure Data Factory, when you hover over the right-side on the Dataset, you will see Action (...) --> click on the action and you will find New Dataset. Thanks!

    64613-dataset-1.jpg

    64614-dataset-2.jpg

    ----------

    If the above response is helpful, please accept as answer and upvote it. Thanks!

    0 comments No comments

  2. Shahin Mortazave 491 Reputation points
    2021-02-09T15:53:01.577+00:00

    @Nasreen Akter Thank you for your reply,
    I have 2 questions,

    1. If I understood you correctly to add extra tables to the same pipeline I have to create a new dataset, am I right?
    2. When I did create my pipeline to copy data from some of the tables of my on-perm DB, I use the scheduled option to run every 24 hours, is this means that every 24 hours the tables get copy all over again or only changes will be get copied?

    Thanks


  3. Shahin Mortazave 491 Reputation points
    2021-02-11T13:38:32.903+00:00

    @Nasreen Akter Thank you for the nice info,

    As I meantioned I have already a pipeline that pull data from 4 tables of our on-perm SQL and load to the Azure al tabels to Azure SQL Tables.

    As I understand I have to first add this query to my source dataset, but can I put the name of all of 4 tabels in this query?

    @markus.bohland@hotmail.de ('SELECT * FROM Table1 WHERE FORMAT(CREATION_DATE, ''yyyy-MM-dd HH:mm:ss'') >= ''', pipeline().parameters.pullDataFrom,
    ''' AND FORMAT(CREATION_DATE, ''yyyy-MM-dd HH:mm:ss'') <''', pipeline().parameters.pullDataTo,'''')

    Do you have a document that eplain the steps? becuase I cannot find the dynamic contant and input in your screenshots.

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.