Python 使用多维JSON文件(Api get请求)创建数据库
我对python和数据库相当陌生 我正在寻找一种简单的方法,用Python将大块数据存储到数据库中。我发出API get请求,并返回如下所示的数据: 我希望使用sqlite3,但也可以使用不同的方法。 数据Python 使用多维JSON文件(Api get请求)创建数据库,python,json,database,sqlite,Python,Json,Database,Sqlite,我对python和数据库相当陌生 我正在寻找一种简单的方法,用Python将大块数据存储到数据库中。我发出API get请求,并返回如下所示的数据: 我希望使用sqlite3,但也可以使用不同的方法。 数据 { "Paging": { "Page": 1, "TotalPages": 1014, "TotalRows": 50663, "PageSize": 50
{
"Paging": {
"Page": 1,
"TotalPages": 1014,
"TotalRows": 50663,
"PageSize": 50
},
"ErrorMessage": null,
"ErrorCode": 0,
"Data": [
{
"RebateDifference": 0.00,
"ShippingIds": [],
"AcceptLossOfReturnRight": false,
"Id": "1689753813076",
"OrderNumber": "#1001",
"State": 3,
"VatMode": 0,
"CreatedAt": "2019-09-20T11:10:35",
"ShippedAt": "2019-09-20T11:10:36",
"ConfirmedAt": null,
"PayedAt": "2019-09-20T11:32:32",
"SellerComment": null,
"Comments": [],
"InvoiceNumberPrefix": "",
"InvoiceNumberPostfix": null,
"InvoiceNumber": 1286,
"InvoiceDate": "2019-11-11T00:00:00",
"InvoiceAddress": {
"BillbeeId": 79813530,
"FirstName": "Name",
"LastName": "Lastname",
"Company": "",
"NameAddition": null,
"Street": "street",
"HouseNumber": "73a",
"Zip": "76137",
"City": "Karlsruhe",
"CountryISO2": "DE",
"Country": "DE",
"Line2": "",
"Email": "Mail@gmail.com",
"State": "",
"Phone": null
},
"ShippingAddress": {
"BillbeeId": 79813530,
"FirstName": "Name",
"LastName": "Name",
"Company": "",
"NameAddition": null,
"Street": "street",
"HouseNumber": "73a",
"Zip": "76137",
"City": "Karlsruhe",
"CountryISO2": "DE",
"Country": "DE",
"Line2": "",
"Email": "mail@gmail.com",
"State": "",
"Phone": null
},
"PaymentMethod": 31,
"ShippingCost": 0.0,
"TotalCost": 31.90,
"AdjustmentCost": 0.0,
"AdjustmentReason": null,
"OrderItems": [
{
"BillbeeId": 143336888,
"TransactionId": "3760601071700",
"Product": {
"OldId": null,
"Id": null,
"Title": "title",
"Weight": null,
"SKU": null,
"SkuOrId": null,
"IsDigital": null,
"Images": null,
"EAN": null,
"PlatformData": null,
"TARICCode": null,
"CountryOfOrigin": null,
"BillbeeId": null
},
"Quantity": 1.000,
"TotalPrice": 31.90000000000,
"TaxAmount": 5.093277310924369747899159664,
"TaxIndex": 1,
"Discount": 0.0000,
"Attributes": [
{
"Id": "xx",
"Name": "",
"Value": null,
"Price": 0.0
}
],
"GetPriceFromArticleIfAny": false,
"IsCoupon": false,
"ShippingProfileId": null,
"DontAdjustStock": false,
"UnrebatedTotalPrice": 31.9000000,
"SerialNumber": null
}
],
"Currency": "EUR",
"Seller": {
"Platform": "Shopify",
"ShopName": "store",
"ShopId": "x",
"Id": "78537a6a-c8ec-4e7a-98a2-7f4b077c42cf",
"Nick": null,
"FirstName": null,
"LastName": null,
"FullName": "",
"Email": "mail@gmail.com"
},
"Buyer": null,
"UpdatedAt": null,
"TaxRate1": 19.00,
"TaxRate2": 7.00,
"BillBeeOrderId": 79930247,
"BillBeeParentOrderId": null,
"VatId": null,
"Tags": [],
"ShipWeightKg": 0.1,
"LanguageCode": null,
"PaidAmount": null,
"ShippingProfileId": null,
"ShippingProviderId": null,
"ShippingProviderProductId": null,
"ShippingProviderName": null,
"ShippingProviderProductName": null,
"ShippingProfileName": null,
"PaymentInstruction": null,
"IsCancelationFor": null,
"PaymentTransactionId": null,
"DistributionCenter": null,
"DeliverySourceCountryCode": null,
"CustomInvoiceNote": null,
"CustomerNumber": "260",
"PaymentReference": "123",
"ShippingServices": null,
"Customer": {
"Id": 123,
"Name": "Name",
"Email": "Mail@gmail.com",
"Tel1": null,
"Tel2": null,
"Number": 260,
"PriceGroupId": null,
"LanguageId": null,
"VatId": null,
"Type": null
},
"History": [
{
"Created": "2019-10-31T09:13:00",
"EventTypeName": "Auftrag eingelesen",
"Text": "Der Auftrag wurde eingelesen",
"EmployeeName": null,
"TypeId": 0
},
{
"Created": "2019-09-20T11:10:35",
"EventTypeName": "Auftrag eingegangen",
"Text": "Der Auftrag ist eingegangen",
"EmployeeName": null,
"TypeId": 86
}
],
"Payments": [],
"LastModifiedAt": "2019-11-11T15:14:08.207"
}, {...}}
如何将值自动插入到不同的表中?我需要得到所有标题的列表并将其插入到不同的表中,对吗
我知道这个问题不是很具体,但也许有人能帮我解决。Hi@Philipp,欢迎来到SO,我想你需要先了解一下web框架,比如Django、flask或pyramid来解决你的问题。我这么说是因为你的项目实际上有很多问题。例如,首先需要解析数据、构建完整的数据库、创建表、向表中添加数据、执行数据验证等。我个人建议从Django开始。我希望这在某种程度上回答了你的问题?谢谢@VJMagar,我想用Flask做这个。这是一个我想进一步了解Python Web开发的项目。我需要更多地了解数据库。。谢谢