导出carto用户数据库度量的模块

carto-report的Python项目详细描述


CARTO报告

一个python模块,用于将数据库度量导出为carto组织用户的html文件。

安装

您可以通过克隆此存储库或使用Pip

$ pip install carto-report

如果您想使用开发版本,可以直接从github安装:

$ pip install -e git+git://github.com/CartoDB/carto-report.git#egg=carto

如果使用开发版本,您可能还需要安装依赖项:

$ pip install -r requirements.txt

仅在python 3中测试

用法示例

命令行应用程序

该软件包安装一个命令行应用程序carto_report,该程序具有以下使用说明:

$ carto_report -h
usage: carto_report [-h] [--user-name CARTO_USER] [--api_key CARTO_API_KEY]
                    [--api_url CARTO_API_URL] [--organization CARTO_ORG]
                    [--output OUTPUT] [--quota QUOTA]
                    [--loglevel {DEBUG,INFO,WARNING,ERROR}]

CARTO reporting tool

optional arguments:
  -h, --help            show this help message and exit
  --user-name CARTO_USER, -U CARTO_USER
                        Account user name (defaults to env variable
                        CARTO_USER)
  --api_key CARTO_API_KEY, -a CARTO_API_KEY
                        Api key of the account (defaults to env variable
                        CARTO_API_KEY)
  --api_url CARTO_API_URL, -u CARTO_API_URL
                        Set the base URL. For example:
                        https://username.carto.com/ (defaults to env variable
                        CARTO_API_URL)
  --organization CARTO_ORG, -o CARTO_ORG
                        Set the name of the organization account (defaults to
                        env variable CARTO_ORG)
  --output OUTPUT       File path for the report, defaults to report.html
  --quota QUOTA, -q QUOTA
                        LDS quota for the user, defaults to 5000
  --loglevel {DEBUG,INFO,WARNING,ERROR}, -l {DEBUG,INFO,WARNING,ERROR}
                        How verbose the output should be, default to the most
                        silent

作为python模块

fromcarto_report.reportimportReporterreporter=Reporter(CARTO_USER,CARTO_API_URL,CARTO_ORG,API_KEY,USER_QUOTA)withopen('/tmp/report.html','w')aswriter:writer.write(reporter.report())

其中不同的参数是:

  • CARTO_USER:要检查的帐户的用户名
  • CARTO_API_URL:这通常是https://{CARTO_USER}.carto.com/,但如果不使用carto.com帐户,则可能有所不同。
  • CARTO_API_KEY:您的carto引擎主api密钥
  • USER_QUOTA:您的lds配额

已知问题

  • [X]改进报告布局和样式(使用飞艇)。
  • []添加断言。
  • []在模板中使用条件。
  • [X]将调试日志添加到打赌反馈中,特别是在获取所有表和分析时。
  • [X]将日志记录作为适当的库。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java有没有办法在堆栈后保留元素。pop()?   多线程Java:Thread。currentThread()。getName()返回“还没有线程”   java For循环只返回最后一个值   java初始化和比较整数   Java将自定义光标热点设置为图像的中心(.png)   java如何在assertThat中使用带有类型推断的hamcrest nullValue   java Quarkus REST客户端避免空字段的JSON序列化   java使用JFileChooser将语音从文本保存到语音文件   java Android Studio找不到JAR'org。日食jgit4。5.3.201708160445r。罐子   java如何在ElasticSearch中使用带通配符的术语?   java可能的空指针异常安卓   在JavaSwing中使用AwesomeFont中的自定义字体和unicode字符向JButton添加图标?   部署过程中的java持久化单元名称问题WildFly   JavaSpring数据:我无法在数据库中保存关系模型   字符串如何计算文件中单词的长度?JAVA   java Eclipse调试器中变量项旁边的id=xxx是什么   httpclient Java httppost文件打印后上载速度   JAXB对象不实现可序列化的结果是什么?   java Spring JPA数据:自定义通用存储库和服务:未满足PendencyException   java如何从解析类中检索所有值?