我想将JSON文件上的数据导入PostgreSQL。但是,我想使用bash脚本来做到这一点。 JSON文件的名称将表示PostgrSQL中表的名称。我有一些JSON要导入PostgreSQL。如何在bash脚本中执行此操作?我正在使用osx。
请帮帮我。
以下是我的JSON文件示例。
[
{
"id": "101",
"name": "User Registered",
"description": "User has been registered. This is the first status after register.",
"created_at": "2017-11-25 15:41:28",
"updated_at": "2017-11-25 15:41:28"
},
{
"id": "102",
"name": "User active",
"description": "User is active. She/He has been confirm it by activation code that sent through email",
"created_at": "2017-11-25 15:41:28",
"updated_at": "2017-11-25 15:41:28"
},
{
"id": "103",
"name": "User deleted",
"description": "User request to delete her/his account",
"created_at": "2017-11-25 15:41:28",
"updated_at": "2017-11-25 15:41:28"
},
{
"id": "104",
"name": "User banned",
"description": "User get banned for some reason.",
"created_at": "2017-11-25 15:41:28",
"updated_at": "2017-11-25 15:41:28"
}
]