Skip to main content

用于提取数据的 Singer.io 目标

项目描述

目标-avro

这是一个Singer目标,它按照Singer 规范读取 JSON 格式的数据。

特征

  • 为Singer流输出 Avro 文件
  • smart_open支持输出到 Google Cloud Storage 和 Amazon S3 等云存储。

安装

pip install target-avro

用法

# simple
cat <<EOF | target-avro -c sample_config.json
{"type":"STATE","value": {}}
{"key_properties":["id"],"schema":{"properties":{"assignee":{"properties":{},"type":["null","object"]},"created_at":{"format":"date-time","type":["null","string"]},"id":{"type":["null","integer"]},"labels":{"items":{"properties":{"id":{"type":["null","integer"]},"name":{"type":["null","string"]}},"type":"object"},"type":["null","array"]},"locked":{"type":["null","boolean"]},"pull_request":{"properties":{"url":{"type":["null","string"]}},"type":["null","object"]},"title":{"type":"string"}},"selected":true,"type":["null","object"]},"stream":"issues","type":"SCHEMA"}
{"type": "RECORD", "stream": "issues", "record": {"created_at":"2020-11-24T23:49:24.000000Z","id":12,"labels":[{"id":238,"name":"ABCDEFGHIJKLMNOPQRSTUV"}],"locked":true,"pull_request":{"url":"https://api.github.com/repos/sample/issues/pulls/999999"},"title":"ABCDEFGHIJKLMNOPQRSTUVWXY"}, "time_extracted": "2021-03-25T12:53:51.817781Z"}
{"type": "STATE", "value": {"bookmarks": {"singer-io/singer-python": {"issues": {"since": "2020-11-24T23:49:24.000000Z"}}}}}
EOF

# complex
cat ./tests/data/github.jsonl | target-avro -c sample_config.json

配置

可在配置文件中指定的字段在此处指定。

场地 类型 默认 细节
prefix ["string"] N/A 输出 uri 前缀。有关有效值和凭据的信息,请参阅smart_open 。
disable_collection ["boolean", "null"] false 包括true在您的配置中以禁用Singer Usage Logging
logging_level ["string", "null"] "INFO" 记录的级别。设置为DEBUG执行 HTTP 请求、JSON 和 Avro 模式等。有关有效值的信息,请参阅Python 的 Logger Levels 。

已知限制

  • 每个流都需要一个JSON 模式
  • 仅支持字符串、具有日期时间格式的字符串、整数、数字、布尔值、对象以及带或不带 null 的数组类型。数组可以列出任何其他类型,包括作为项目中的类型的对象。
    • 有效的 JSON Schema 类型示例
      • ['number']
      • ['string']
      • ['string', 'null']
    • 不起作用的 JSON Schema 类型示例
      • ['string', 'integer']
      • ['integer', 'number']
      • ['any']
      • ['null']
  • 不支持JSON Schema 组合,例如anyOf和。oneOf
  • $ref不支持JSON 架构。

使用记录

Singer.io需要官方点击和目标来收集匿名使用数据。此数据仅用于汇总报告单个点击/目标以及整个 Singer 社区。记录 IP 地址以检测唯一的点击/目标用户,但不与第三方共享。

要禁用匿名数据收集,请在配置 JSON 文件中将 disable_collection 设置为 true。


版权所有 © 2021 影法师

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

target-avro-0.2.0.tar.gz (6.1 kB 查看哈希

已上传 source

内置分布

target_avro-0.2.0-py3-none-any.whl (6.1 kB 查看哈希

已上传 py3