一个Python包,用于读写CDM格式的文件。为SkyPoint用例定制。
cdm-connector的Python项目详细描述
skypoint python cdm连接器
SkyPoint的Python Spark CDM连接器。在
用于Microsoft Azure“公共数据模型”的Apache Spark连接器。支持阅读和写作,这是一项正在进行的工作。如果有任何问题,请查找该文件。在
有关Azure公共数据模型的更多信息,请查看this page。
我们支持azuredatalake服务(ADLS)和aws3作为存储,使用模式和数据文件的快照保存历史数据,并在PySpark、Azure函数等中使用
*即将支持增量数据刷新处理,[cdm1.1](https://docs.microsoft.com/en-us/common-data-model/cdm-manifest)和Google云(云存储)。
示例
- 请查看示例用法文件skypoint_python_清洁发展机制在
- 实体,动态添加/删除属性
- 传递您要向其写入/读取数据的任何存储帐户的Reader和Writer对象。在
- 查看下面的代码以获取基本的读写示例。在
# Initialize empty modelm=Model()# Sample dataframedf={"country":["Brazil","Russia","India","China","South Africa","ParaSF"],"currentTime":[datetime.now(),datetime.now(),datetime.now(),datetime.now(),datetime.now(),datetime.now()],"area":[8.516,17.10,3.286,9.597,1.221,2.222],"capital":["Brasilia","Moscow","New Dehli","Beijing","Pretoria","ParaSF"],"population":[200.4,143.5,1252,1357,52.98,12.34]}df=pd.DataFrame(df)# Generate entity from the dataframeentity=Model.generate_entity(df,"customEntity")# Add generated entity to modelm.add_entity(entity)# Add model level annotation# Annotation can be added at entity level as well as attribute levelModel.add_annotation("modelJsonAnnotation","modelJsonAnnotationValue",m)# Create an ADLSWriter to write into ADLSwriter=ADLSWriter("ACCOUNT_NAME","ACCOUNT_KEY","CONTAINER_NAME","STORAGE_NAME","DATAFLOW_NAME")# Write data as well as model.json in ADLS storagem.write_to_storage("customEntity",df,writer)
贡献
这个项目欢迎大家的贡献和建议。在
参考文献
A clean implementation for Python Objects from/to model.json file
- 项目
标签: