How to convert the MySql structured data into NoSql hierarchical data using Azure DataFlows

Nalagatla Mourya 0 Reputation points
2023-01-14T12:21:53.58+00:00

Hi Team,

Actually trying to convert the MySql data set into NoSql Hierarchical data structure format using dataflows in azure data factory, but currently not able to find the right option to configure it.

Please find the below snippets for input/output sources.

User's image

output :

[
  {
    "company" : "company1",
    "projects" : [
      {
        "projectId" : 100,
        "projectSize" :2,
        "employees" : ["M101", "M102"]
      },
      {
        "projectId" : 200,
        "projectSize" :1,
        "employees" : ["M201"]
      }
    ]
  },
  {
    "company" : "company2",
    "projects" : [
      {
        "projectId" : 300,
        "projectSize" :1,
        "employees" : ["M301"]
      }
    ]
  }
]
Azure Database Migration service
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vinodh247 34,661 Reputation points MVP Volunteer Moderator
    2023-01-15T01:31:40.65+00:00

    Hi

    Thanks for reaching out to Microsoft Q&A.

    While this may be done for small datasets, I am not sure how successful and easy this would be to implement when it comes to converting huge amount of data. I have found some links that had discussed about such requirements, you can go through and see if it works. I know these might not be a ready to implement solution but can guide you to the right direction.

    [https://stackoverflow.com/questions/8849571/relational-to-nosql-database

    [https://learn.microsoft.com/en-us/azure/data-factory/connector-azure-cosmos-db?tabs=data-factory

    Same requirement was discussed by mongodb in a webinar.

    [https://www.mongodb.com/presentations/webinar-transitioning-from-sql-to-mongodb

    Please Upvote and Accept as answer if the reply was helpful, this will be helpful to other community members.

    0 comments No comments

  2. AnnuKumari-MSFT 34,551 Reputation points Microsoft Employee Moderator
    2023-01-17T10:32:30.6133333+00:00

    Hi Nalagatla Mourya ,

    Welcome to Microsoft Q&A platform and thanks for posting your question here.

    I understand you are trying to transform your data from relational dataset to non relational dataset.

    Here I am trying to achieve the same keeping the input data into .csv file. However, you can try to point the input dataset to MySQL database instead and follow the below steps:

    1. Add Aggregate transformation and Group by 'companyName' and 'projectID' and in aggregate tab , provide expression as 'collect(employeeID)' User's image User's image
    2. Add another Aggregate transformation to group by using 'companyName' and aggregate with expression as: collect(@(projectID=projectID,projectSIZE=projectSIZE,employees=employees))

    User's image

    User's image

    1. Add sink transformation to load the data into json file .

    User's image


    Hope it helps. Please do consider clicking Accept Answer and Up-Vote for the same as accepted answers help community as well


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.