将关系数据从MSSQL(Azure SQL Server)移动到MySQL数据库

将关系数据从MSSQL(Azure SQL Server)移动到MySQL数据库,mysql,sql-server,prisma,Mysql,Sql Server,Prisma,将大型数据集从MSSQL(Azure SQL Server)复制到自托管MySQL数据库的正确方法是什么?为了增加复杂性,需要每晚更新web应用程序使用的价格、产品等 目前我们有一个Node.js脚本,它逐表查询所有内容,并在MySQL数据库中创建具有相同数据、外键和主键的行。这适用于较小的表。主要问题是客户和价格表,以及它们之间的多对多关系。目前,MSSQL中有一个CustomerPrices表,其中包含定义的关系,它有4400多万行。Customers表本身只有3000行,Prices只有5

将大型数据集从MSSQL(Azure SQL Server)复制到自托管MySQL数据库的正确方法是什么?为了增加复杂性,需要每晚更新web应用程序使用的价格、产品等

目前我们有一个Node.js脚本,它逐表查询所有内容,并在MySQL数据库中创建具有相同数据、外键和主键的行。这适用于较小的表。主要问题是客户和价格表,以及它们之间的多对多关系。目前,MSSQL中有一个CustomerPrices表,其中包含定义的关系,它有4400多万行。Customers表本身只有3000行,Prices只有50万行

下面是MSSQL中客户、价格和客户价格的模式:

model CustomersPrices {
  PriceID       Int?
  CustomerID    Int?
  Private_Label String?
  Customers     Customers? @relation(fields: [CustomerID], references: [ID])
  Prices        Prices?    @relation(fields: [PriceID], references: [ID])
}

model Customers {
  ID                      Int               @id @default(autoincrement())
  No_                     String?
  Name                    String?
  Customer_Price_Group    String?
  Customer_Disc__Group    String?
  Customer_PL_Price_Group String?
  Customer_PL_Disc__Group String?
  PL_Text                 String?
  Closed_Status           String?
  Credit_Limit__LCY_      Decimal?
  Current_Balance__LCY_   Decimal?
  Remaining_Limit__LCY_   Decimal?
  Salesperson_Code        String?
  Responsibility_Center   String?
  Address                 String?
  Address_2               String?
  Post_Code               String?
  City                    String?
  Shipment_Method_Code    String?
  Bill_to_Customer_No_    String?
  Show_Limit_Info         Int?
  Primary_Contact_No_     String?
  InsertedDatetime        DateTime
  SalesPersonID           Int?
  Salesperson             Salesperson?      @relation(fields: [SalesPersonID], references: [ID])
  Contact                 Contact[]
  CustomersPrices         CustomersPrices[]
  Sales_Header            Sales_Header[]
}

model Prices {
  ID                        Int               @id @default(autoincrement())
  Item_No_                  String?
  Variant_Code              String?
  Sales_Type                String?
  Sales_Code                String?
  Unit_of_Measure_Code      String?
  Sales_Minimum_Quantity    Decimal?
  Unit_Price                Decimal?
  Discount_Minimum_Quantity Decimal?
  Discount_Pct              Decimal?
  Starting_Date             DateTime?
  Ending_Date               DateTime?
  InsertedDatetime          DateTime 
  ProductID                 Int?
  Products                  Products?         @relation(fields: [ProductID], references: [ID])
  CustomersPrices           CustomersPrices[]
}
按照指示,我们无法直接将MSSQL用于web应用程序

目前,我们正在尝试将Node.js与Prisma.io(用于MySQL)和冗长(用于查询MSSQL)一起使用


我现在真的觉得很难受。你将如何建造这个?提前谢谢你。

你不想务实地做这件事。有一些工具可以解决数据迁移问题。查看如何使用MySQL Workbench完成此任务: