Tableau 怎么连接 Cassandra 数据库

俊晗 2017-10-14 11:46:38
我现想通过Tableau desktop 可视化工具。 连接 云上的Cassandra 数据库,弄了好多天了啊,没有连上。请大神指点下?
...全文
650 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
碧水幽幽泉 2017-10-24
  • 打赏
  • 举报
回复
引用 5 楼 gqv2009 的回复:
第五项:请教大神,帮帮忙,写Python 程序连接Cassandra . 请案例

这个应该到Python版块去问。 本人Python只懂基础。
俊晗 2017-10-24
  • 打赏
  • 举报
回复
第五项:请教大神,帮帮忙,写Python 程序连接Cassandra . 请案例
俊晗 2017-10-24
  • 打赏
  • 举报
回复
追问 : 就是通过Python程序语言连接Cassandra数据源,生成Tableau数据提取(.tde)文件 一、支持语言: C C++ Java Python versions 2.6 and 2.7. 二、准备工作 1.下载Tableau Tableau下载地址(试用15天):https://www.tableau.com/zh-cn/products/trial 2.安装Tableau 输入企业邮箱后可以免费试用15天,根据提示安装即可 3.Windows 安装python2.7 首先去python官网下载Python2.79安装程序,或者不知道官网地址的话,你也可以在百度下搜索python-2.7.9.msi安装文件 三、下载python第三方安装包 1.安装numpy numpy是matplotlib和scipy包安装的先行要求。因此要先安装numpy。pip工具一条命令就可以快速下载安装,推荐使用pip。 在命令行中跳转到python的安装地址下的\scripts文件夹,然后输入如下命令: python -m pip install numpy pip工具会自动连接远程服务器,完成下载和安装的工作。如果没有弹出错误信息的话,那么安装就是顺利的。你可以在python的IDE下测试其安装是否完成。 import numpy 2.安装matplotlib matplotlib需要三个先行包,如果用exe安装的话还需要手动安装其他三个包。如果用pip就没有这么多问题。 和上面一样,在命令行中输入如下命令: python -m pip install matplotlib 然后测试安装是否成功。 3.安装scipy 安装scipy的时候遇到了一些问题,pip工具安装时报错。具体的错误我在网上搜索了一下,可能是因为缺少mkl库的原因。 一个解决方法是,在网上的镜像源Unofficial Windows Binaries for Python Extension Packages中下载numpy+mkl的whl文件和scipy文件,再用pip安装。具体命令为: python -m pip install <FILE_NAME> 4.根据自己需求下载第三方包 5.若遇到下载第三方包报连接超时,请试着用无线网下载。 6.安装Tableau SDK 包 Tableau SDK for Python(64位)(.zip文件) 要获取Tableau SDK,请使用以下列表中的相应链接。 https://onlinehelp.tableau.com/current/api/sdk/en-us/SDK/tableau_sdk_installing.htm 7. Tableau数据提取API下载 Tableau Data Extract API Download .Python 64位版本(Zip文件 - 11.6 MB) https://www.tableau.com/zh-cn/products/api-download 8.安装Cassandra 驱动程序 pip install cassandra-driver 具体安装Cassandra 驱动程序请使用以下相应链接 https://datastax.github.io/python-driver/installation.html 四、通过Python代码样例,生成Tableau数据提取(.tde)文件 创建提取的步骤 1. 初始化提取 2. 定义表和列 3.初始化表 4. 创建行并填充 5. 保存表和提取 6.释放提取API 一下给出Python为例的代码一 import sys from tableausdk import * from tableausdk.Extract import * ExtractAPI.initialize() new_extract = Extract('employees.tde') # Create a new table definition with 3 columns table_definition = TableDefinition() table_definition.addColumn('id', Type.INTEGER) # column 0 table_definition.addColumn('name', Type.UNICODE_STRING) # column 1 table_definition.addColumn('start_date', Type.DATE) # column 2 new_table = new_extract.addTable('Extract', table_definition) # Create new row new_row = Row(table_definition) # Pass the table definition to the constructor # Set column values. The first parameter is the column number (its # ordinal position) The second parameter (or second and subsequent paramaters) is # the value to set the column to. new_row.setInteger(0, 1) new_row.setString(1, 'Amanda') new_row.setDate(2, 2014, 6, 9) new_table.insert(new_row) # Add the new row to the table new_row.setInteger(0, 2) new_row.setString(1, 'Brian') new_row.setDate(2, 2014, 10, 13) new_table.insert(new_row) new_row.setInteger(0, 3) new_row.setString(1, 'Christina') new_row.setDate(2, 2015, 2, 16) new_table.insert(new_row) # Close the extract in order to save the .tde file and clean up resources new_extract.close() ExtractAPI.cleanup() 五、通过Python代码样例,连接Cassandra数据源,生成Tableau数据提取(.tde)文件 (待续) 更多例子请参考: http://onlinehelp.tableau.com/current/api/sdk/en-us/help.htm#SDK/tableau_sdk_working_with_extracts.htm%3FTocPath%3D_____7 参考视频资源: https://www.tableau.com/zh-cn/learn/tutorials/on-demand/extract-api-introduction
sz_jack 2017-10-22
  • 打赏
  • 举报
回复
没有你数据库,估计不行哦!问问厂家支持不!
碧水幽幽泉 2017-10-14
  • 打赏
  • 举报
回复
路过,帮顶了。
碧水幽幽泉 2017-10-14
  • 打赏
  • 举报
回复
Cassandra 数据库头次听说

3,492

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧