用于将数据加载到PostgreSQL的singer.io目标-管道兼容

pipelinewise-target-postgres的Python项目详细描述


管道式目标postgres

PyPI versionPyPI - Python VersionLicense: MIT

SingerSinger spec之后将数据加载到雪花中的目标。

这是一个PipelineWise兼容的目标连接器。

如何使用

运行此目标的建议方法是从PipelineWise中使用它。当从pipelinewise运行它时,您不需要用json文件配置这个tap,而且大多数事情都是自动化的。请查看Target Postgres上的相关文档

如果要独立运行此Singer Target,请进一步阅读。

安装

首先,确保python 3安装在您的系统上,或者遵循以下步骤 Mac或的安装说明 Ubuntu

建议使用virtualenv:

  python3 -m venv venv
  pip install pipelinewise-target-postgres

  python3 -m venv venv
  . venv/bin/activate
  pip install --upgrade pip
  pip install .

运行

像其他任何一个目标一样,遵循歌手的具体要求:

some-singer-tap | target-postgres --config [config.json]

它从stdin读取传入消息,并使用config.json中的属性将数据上载到postgres。

注意:要避免版本冲突,请在单独的虚拟环境中运行taptargets

配置设置

运行目标连接器需要一个config.json文件。最小设置的示例:

{"host":"localhost","port":5432,"user":"my_user","password":"secret","dbname":"my_db_name","default_target_schema":"my_target_schema"}

config.json

中选项的完整列表
PropertyTypeRequired?Description
hostStringYesPostgreSQL host
portIntegerYesPostgreSQL port
userStringYesPostgreSQL user
passwordStringYesPostgreSQL password
dbnameStringYesPostgreSQL database name
batch_sizeInteger(Default: 100000) Maximum number of rows in each batch. At the end of each batch, the rows in the batch are loaded into Snowflake.
default_target_schemaStringName of the schema where the tables will be created. If ^{} is not defined then every stream sent by the tap is loaded into this schema.
default_target_schema_select_permissionStringGrant USAGE privilege on newly created schemas and grant SELECT privilege on newly created
schema_mappingObjectUseful if you want to load multiple streams from one tap to multiple Snowflake schemas.

If the tap sends the ^{} in ^{} format then this option overwrites the ^{} value. Note, that using ^{} you can overwrite the ^{} value to grant SELECT permissions to different groups per schemas or optionally you can create indices automatically for the replicated tables.

Note: This is an experimental feature and recommended to use via PipelineWise YAML files that will generate the object mapping in the right JSON format. For further info check a PipelineWise YAML Example.
add_metadata_columnsBoolean(Default: False) Metadata columns add extra row level information about data ingestions, (i.e. when was the row read in source, when was inserted or deleted in postgres etc.) Metadata columns are creating automatically by adding extra columns to the tables with a column prefix ^{}. The column names are following the stitch naming conventions documented at https://www.stitchdata.com/docs/data-structure/integration-schemas#sdc-columns. Enabling metadata columns will flag the deleted rows by setting the ^{} metadata column. Without the ^{} option the deleted rows from singer taps will not be recongisable in Snowflake.
hard_deleteBoolean(Default: False) When ^{} option is true then DELETE SQL commands will be performed in Snowflake to delete rows in tables. It's achieved by continuously checking the ^{} metadata column sent by the singer tap. Due to deleting rows requires metadata columns, ^{} option automatically enables the ^{} option as well.

运行测试:

  1. 定义需要运行测试的环境变量
  export TARGET_POSTGRES_HOST=<postgres-host>
  export TARGET_POSTGRES_PORT=<postgres-port>
  export TARGET_POSTGRES_USER=<postgres-password>
  export TARGET_POSTGRES_PASSWORD=<postgres-password>
  export TARGET_POSTGRES_DBNAME=<postgres-dbname>
  export TARGET_POSTGRES_SCHEMA=<postgres-schema>
  1. 在虚拟环境中安装python依赖项并运行nose单元和集成测试
  python3 -m venv venv
  . venv/bin/activate
  pip install --upgrade pip
  pip install .
  pip install nose
  1. 运行单元测试:
  nosetests --where=tests/unit
  1. 要运行集成测试:
  nosetests --where=tests/integration

运行pylint:

  1. 安装python依赖项并运行python linter
  python3 -m venv venv
  . venv/bin/activate
  pip install --upgrade pip
  pip install .
  pip install pylint
  pylint target_postgres -d C,W,unexpected-keyword-arg,duplicate-code

许可证

apache许可证2.0版

请参见LICENSE以查看全文。

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

推荐PyPI第三方库


热门话题
具有较旧spring启动版本的java Maven依赖项   java如何在安卓中获取移动网络活动计划使用历史记录   java CXF抛出了所有策略替代方案都无法满足的问题   java如何创建类似ApachePOI的程序   Java Hashmap如何处理单词网格中的键冲突   java如何在多个下拉列表中搜索下一个元素   如何将css文件导入我的JavaSpringWebApp?   如何在Java中将字符串[]转换为字符串[]?   排序如何在Java中根据列的组合对spark dataframe进行排序?   java错误:无法访问com的zzbej类文件。谷歌。安卓gms。内部的没有找到zzbej   illegalargumentexception Java Comparator引发非法参数异常   java删除ShaperRenderer偏移量   安卓中的java出生日期问题   设置MediaBrowserService和MediaSession时遇到java问题   java对抛出声明的澄清   java在IntelliJ IDEA的Gradle项目的“提供”范围内添加依赖项   带2个变量的java For循环?   java是一个更平坦的问题   使用JACOB保存Word文档(Java)