Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MagicTooooools/Json2DB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

JSON TO DATABASE

保存JSON文件到数据库,会自动创建表,并根据JSON数据结构自动创建字段,并插入数据

⚠️注意: 作者只验证了PostgresSQL数据库

使用方式

$ json2db -h
错误: 必须提供 -db_name 和 -table_name 参数
Usage of json2db:
 -config string
 	配置文件路径(默认 $HOME/.Json2DB/config.yaml)
 -db_name string
 	数据库名称(必需)
 -init
 	初始化配置文件
 -table_name string
 	数据表名称(必需)
 -verbose
 	输出调试日志

作者常用操作

$ httpx -l full_urls.txt -title -sc -random-agent -retries 1 -timeout 3 -fr -fhr -ob -j -o httpx_all_urls_res.txt 
$ cat httpx_all_urls_res.txt | json2db -db_name ________ -table_name httpx_res
数据库连接成功
表 httpx_res 创建成功
表 httpx_res 创建成功
数据重复,SHA256 39b307e93c8248d81d2b1ee833593bcc6f176639c33c9ef9b7ecc21c92c18c72 已存在,跳过插入
数据重复,SHA256 904939bc5b6f2508e7601c109e5ad479251bdba3d7742cdb712fec080fffec2e 已存在,跳过插入
数据插入表 httpx_res 成功,SHA256: b4674fb28438573f7fa1934c21807d30de9e664212bbbbf43bbc854f65985bcb
插入数据成功: b4674fb28438573f7fa1934c21807d30de9e664212bbbbf43bbc854f65985bcb
数据插入表 httpx_res 成功,SHA256: 4edcca0ca3725c6c3d959fa83cc8d309016cdf84c99471b062f5f746ab243d08
插入数据成功: 4edcca0ca3725c6c3d959fa83cc8d309016cdf84c99471b062f5f746ab243d08
...
数据重复,SHA256 4edcca0ca3725c6c3d959fa83cc8d309016cdf84c99471b062f5f746ab243d08 已存在,跳过插入
成功处理 6899 条记录

插入6899条数据,包括创建表和插入全部数据,仅用时 4.301029000 秒

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /