用于连接Postgres/Greenplum、MySQL、MongoDB、Kafka、Redis、MixPanel和Salesforce的Python包装器。还包括用于执行安全文件传输和查找环境变量的模块。

dattasa的Python项目详细描述


帮助数据工程师和数据科学家加速数据管道开发的python包

这个python项目的目标是构建一堆可以 可用于从关系数据库中生成数据管道: Postgres、MySQL、Greenplum、Redshift等-NoSQL数据库:Hive, 消息源和缓存:kafka、redis、rabbitmq等。 -云服务提供商:Salesforce、MixPanel、Jira、Google Drive, 很高兴,低音等等。

安装

有三种方法可以安装Dattasa软件包-

  1. 最简单的方法是使用pip从pypi安装
pip install dattasa
  1. 从github下载并从头开始构建
git clone git@github.com:kartikra/dattasa.git
cd dattasa
python setup.py build
python setup.py clean
python setup.py install
  1. 从github下载并使用pip安装
git clone git@github.com:kartikra/dattasa.git
cd dattasa
pip install -e .
pip install -U -e . (if upgrading)

配置文件

默认情况下,dattasa希望配置文件位于mode目录中 用户的。这些可以被覆盖。请参阅自述文件中示例代码的链接 请在下面的文件中查找更多信息。有两个yaml配置文件- database.yaml-所需的数据库凭据和api密钥的圆锥图 建立联系。请参见sample database config-ftpsites.yaml-needed for 执行SFTP传输。见sample ftpsites config

环境变量

dattasa包依赖于以下环境变量。确保 在bash profile-gpload_home:path to gpload包中设置这些 (仅当对Greenplum或Redshift使用gpload实用程序时才需要)- project_home:指向python项目目录的路径- project_home/python_bash_脚本:调用gpload的python脚本 (仅当对Greenplum或Redshift使用gpload实用程序时才需要)- SQL目录:保存所有SQL脚本的位置-temp目录:所有临时文件 在此文件夹中创建-日志目录:所有日志文件都在 文件夹

类别说明

包的v1.0包含以下类。请看链接 以获取有关如何使用它们的详细信息的示例代码。

classDescriptionSample Code
environmentLets you source all the os environment variablessee first row in mongo example
postgres_clien tLets you use psql and gpload utilities provided by pivotal greenplum. Make connections to postgres / greenplum database using pyscopg2 or sqlalchemy.Use the connections to interact with database in interactive program or run queries from a sql file using the connectionsample postgres code
greenplum_clie nt (inherits postgres_clien t)Lets you use psql and gpload utilities provided by pivotal greenplum. Make connections to postgres / greenplum database using pyscopg2 or sqlalchemy.Use the connections to interact with database in interactive program or run queries from a sql file using the connectionsample greenplum code
mysql_clientLets you use mysql and other methods provided by PyMySQL Packagesample mysql code
file_processorCreate sftp connection using paramiko package. Other file manipulations like row_count, encryption, archive (File Class)see file processing example
notificationSend email notifications
mongo_clientLoad data to mongodb using bulk load. Run java script queriessee mongo example
redis_clientRead data from a redis cache or load a redis cachesee redis example
kafka_systemCurrently allows Publisher and Consumer to use kafka in batch modesee kafka example
rabbitmq_syste mCurrently has Publisher to publish messages in rabbitmq
mixpanel_clien tConnect to mixpanel api and fetch data using jql or export raw events data. mixpanel api documentationsee mixpnael section in api example
salesforce_cli entCreate a connection to salesforce using simple_salesforce packagesee salesforce section in api example
delighted_clie ntGet nps scores and survey responses from delighted.api documentationsee delighted section in api example
wootric_clientGets nps scores and survey responses from wootric.api documentationsee wootric section in api example
dag_controllerFunctions needed to integrate this package within an airflow dag. airflow documentation and github project

数据管道类

这是其他项目可以访问的主类。数据 管道由来自组件和api的数据组成。每个对象 数据处理器可以使用单独的数据流并对其进行处理 数据管道根据数据库类型决定调用哪些模块 (在配置文件中定义)。数据管道由3类组成- datacomponent:每个数据库连接都被认为是 数据组件对象。参见Postgres、MySQL、Greenplum等示例 api call之上:每个api调用都是一个apicall对象。参见示例 MixPanel,高兴,Salesforce和Wootric以上-数据处理器: 在数据组件之间传输和加载数据。see examples

将ipython笔记本文件添加到github

使用Git LFS请参见 documentation

  • 如果使用Mac,请使用Brew安装Git LFS^{TT1}$
  • 安装lfsgit lfs install
  • 跟踪项目中的ipynb文件。转到项目文件夹并执行 git lfs track "*.psd"
  • .*ipynb_checkpoints/添加到.gitignore文件
  • 最后添加.gittattributes文件git add .gitatttributes

在pypi中部署代码

  • 生成代码: python setup.py build && python setup.py clean && python setup.py install
  • 推到pypitest:python setup.py sdist upload -r pypitest
  • 推到pypi prod:python setup.py sdist upload -r pypi

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

推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像