Ready to get started?

Download a free trial of the Kintone Connector to get started:

 Download Now

Learn more:

Kintone Icon Kintone Python Connector

Python Connector Libraries for Kintone Data Connectivity. Integrate Kintone with popular Python tools like Pandas, SQLAlchemy, Dash & petl.

Use pandas to Visualize Kintone Data in Python

The CData Python Connector for Kintone enables you use pandas and other modules to analyze and visualize live Kintone data in Python.

The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for Kintone, the pandas & Matplotlib modules, and the SQLAlchemy toolkit, you can build Kintone-connected Python applications and scripts for visualizing Kintone data. This article shows how to use the pandas, SQLAlchemy, and Matplotlib built-in functions to connect to Kintone data, execute queries, and visualize the results.

With built-in optimized data processing, the CData Python Connector offers unmatched performance for interacting with live Kintone data in Python. When you issue complex SQL queries from Kintone, the driver pushes supported SQL operations, like filters and aggregations, directly to Kintone and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).

Connecting to Kintone Data

Connecting to Kintone data looks just like connecting to any relational data source. Create a connection string using the required connection properties. For this article, you will pass the connection string as a parameter to the create_engine function.

In addition to the authentication values, set the following parameters to connect to and retrieve data from Kintone:

  • Url: The URL of your account.
  • GuestSpaceId: Optional. Set this when using a guest space.

Authenticating with Kintone

Kintone supports the following authentication methods.

Using Password Authentication

You must set the following to authenticate:

  • User: The username of your account.
  • Password: The password of your account.

Using Basic Authentication

If the basic authentication security feature is set on the domain, supply the additional login credentials with BasicAuthUser and BasicAuthPassword. Basic authentication requires these credentials in addition to User and Password.

Using Client SSL

Instead of basic authentication, you can specify a client certificate to authenticate. Set SSLClientCert, SSLClientCertType, SSLClientCertSubject, and SSLClientCertPassword. Additionally, set User and Password to your login credentials.

Follow the procedure below to install the required modules and start accessing Kintone through Python objects.

Install Required Modules

Use the pip utility to install the pandas & Matplotlib modules and the SQLAlchemy toolkit:

pip install pandas
pip install matplotlib
pip install sqlalchemy

Be sure to import the module with the following:

import pandas
import matplotlib.pyplot as plt
from sqlalchemy import create_engine

Visualize Kintone Data in Python

You can now connect with a connection string. Use the create_engine function to create an Engine for working with Kintone data.

engine = create_engine("kintone:///?User=myuseraccount&Password=mypassword&Url=")

Execute SQL to Kintone

Use the read_sql function from pandas to execute any SQL statement and store the resultset in a DataFrame.

df = pandas.read_sql("SELECT CreatorName, Text FROM Comments WHERE AppId = '1354841'", engine)

Visualize Kintone Data

With the query results stored in a DataFrame, use the plot function to build a chart to display the Kintone data. The show method displays the chart in a new window.

df.plot(kind="bar", x="CreatorName", y="Text")

Free Trial & More Information

Download a free, 30-day trial of the CData Python Connector for Kintone to start building Python apps and scripts with connectivity to Kintone data. Reach out to our Support Team if you have any questions.

Full Source Code

import pandas
import matplotlib.pyplot as plt
from sqlalchemy import create_engin

engine = create_engine("kintone:///?User=myuseraccount&Password=mypassword&Url=")
df = pandas.read_sql("SELECT CreatorName, Text FROM Comments WHERE AppId = '1354841'", engine)

df.plot(kind="bar", x="CreatorName", y="Text")