CodePudding user response:
First time heard that Cassandra databaseCodePudding user response:
Pass by, help top,CodePudding user response:
Without your database, it is estimated that not line! Ask manufacturers support is not!
CodePudding user response:
Follow-up: it is through the Python programming language connection Cassandra data sources, generates Tableau data extraction (tde) fileA, support language:
C
C + +
Java
Python versions 2.6 and 2.7.
Second, ready to work
1. Download Tableau
Tableau download address 15 days (trial) : https://www.tableau.com/zh-cn/products/trial
2. Install the Tableau
Input enterprise email after 15 days free trial, can be installed according to the prompt
3. The Windows installation python2.7
First of all to python's official website to download Python2.79 installer, or don't know the website address, you can also under the baidu search python - 2.7.9. Msi installation file
Three, third-party installation package to download python
1. Install numpy
Numpy matplotlib and scipy package to install the first requirement, so need to install numpy, PIP tool is a command can quickly download and install, it is recommended to use PIP, on the command line to jump to the python installation address under \ scripts folder, and then enter the following command:
Python -m PIP install numpy
PIP tool will automatically connect to the remote server, download and installation work, if there is no pop-up error message, so installation is successful, you can test under the python IDE whether the installation is complete,
The import numpy
2. Install matplotlib
Matplotlib need three leading package, if use exe installation need to manually install the other three packages, if use PIP is no so many problems, like above, enter the following command in the command line:
Python -m PIP install matplotlib
And then test the installation success,
3. Install the scipy
When installing scipy encountered some problems, PIP tools installation times fault, the specific error I search on the Internet, probably because the cause of the lack of MKL library, a solution is, a mirror image of the online source Unofficial Windows Binaries for Python Extension Packages download numpy + MKL WHL file and scipy, reoccupy PIP installation, specific command to:
Python -m PIP install & lt; FILE_NAME & gt;
4. According to their own needs to download third-party packages
5. If encounter download third-party packages connection timeout, please try to use wi-fi to download,
6. Install the Tableau SDK packages
Tableau SDK for Python (64) (.zip file)
To obtain a Tableau SDK, please use the following list of the corresponding link,
https://onlinehelp.tableau.com/current/api/sdk/en-us/SDK/tableau_sdk_installing.htm
7. Tableau data extraction API download
The Download Tableau Data Extract API
Python 64 - bit version (Zip file - 11.6 MB)
https://www.tableau.com/zh-cn/products/api-download
8. Installation of Cassandra drivers
PIP install Cassandra - driver
Specific Cassandra driver installation, please use the following link to
https://datastax.github.io/python-driver/installation.html
Four, through the Python code sample, the Tableau data extraction (tde) file
Create an extraction step
1. Initialization extract
2. Define tables and columns
3. The initialization table
Line 4. Create and populate
5. Save the table and extracting
6. Release extract API
Given the Python code, for example a
The import sys
The from tableausdk import *
The from tableausdk. Extract the import *
ExtractAPI. The initialize ()
New_extract=Extract (' employees. Tde)
# the Create a new table definition with 3 columns
Table_definition=TableDefinition ()
Table_definition. AddColumn (' id ', the INTEGER) # column 0
Table_definition. AddColumn (' name 'Type. UNICODE_STRING) # column 1
Table_definition. AddColumn (' the start_date 'Type. The DATE) # column 2
New_table=new_extract. AddTable (' Extract 'table_definition)
# the Create new row
# new_row=Row (table_definition) Pass the table definition to the constructor
# Set The column values. The first parameter is The column number (its
# The ordinal position) The second parameter (or The 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. The cleanup ()
Five, through the Python code sample, connection Cassandra data sources, generates Tableau data extraction (tde) file
(to be continued)
More examples, please reference:
http://onlinehelp.tableau.com/current/api/sdk/en-us/help.htm#SDK/tableau_sdk_working_with_extracts.htm%3FTocPath%3D_____7
Refer to the video resources:
https://www.tableau.com/zh-cn/learn/tutorials/on-demand/extract-api-introduction
CodePudding user response:
Item 5: consult a great god, and to help write a Python program to connect Cassandra. Case, pleaseCodePudding user response: