将JSON字段SQLs单元格保存到文件中,或将其更新回文件
jsc2f的Python项目详细描述
JSC2F:JSON SQL单元格到文件
此模块包含从MySQL或Mariadb保存JSON单元的函数 数据库到一个文件在一个好的和易于使用的格式。它还可以上传JSON 文件返回数据库。在
安装
可以从repogit或repogit hub安装克隆。在
pip install jsc2f
CLI使用示例
download
将把SQL单元格中的JSON字符串保存到格式良好的 用于编辑的文件。在upload
将用JSON文件更新单元格--where
用作选择器:--where "id == 3"
# jsc2f --help Usage: jsc2f [OPTIONS] Upload/Download JSON SQL Cell from/to a local file Options: --where TEXT --table TEXT [required] --column TEXT [required] --db-name TEXT [required] --db-password TEXT [required] --db-user TEXT [required] --db-port INTEGER --db-ip TEXT [required] --filename TEXT [required] --upload / --download Upload or download [required] --help Show this message and exit.
Python模块使用示例
importjsc2f.libasjsc2f# Get data from SQL cell and write it to JSON filejsc2f.save_to_file(filename=filename,host=db_ip,user=db_user,password=db_password,database=db_name,column=column,table=table,where=where,port=db_port)# Get JSON from file and write it to SQL celljsc2f.update_from_file(filename=filename,host=db_ip,user=db_user,password=db_password,database=db_name,column=column,table=table,where=where,port=db_port)
- 项目
标签: