Ready to get started?

Learn more about the CData ODBC Driver for Adobe Analytics or download a free trial:

Download Now

PyCharm でCData ODBC Driver for Adobe Analytics を使ってみた

Adobe Analytics にODBC データソースとしてPyCharm から連携。

CData ODBC Drivers は、ODBC をサポートするあらゆる環境から利用可能です。 本記事では、PyCharm からのCData ODBC Driver for Adobe Analytics の利用を説明します。ODBC Deriver をデータソースとして設定する方法、データソースをクエリするPyCharm のベーシックな方法を含みます。

To begin, this tutorial will assume that you have already installed the CData ODBC Driver for Adobe Analytics as well as PyCharm.

Pyodbc をプロジェクトに追加

Follow the steps below to add the pyodbc module to your project.

  1. Click File -> Settings to open the project settings window.
  2. Click Project Interpreter from the Project: YourProjectName menu.
  3. To add pyodbc, click the + button and enter pyodbc.
  4. Click Install Package to install pyodbc.

Adobe Analytics への接続

You can now connect with an ODBC connection string or a DSN. See the Getting Started section in the CData driver documentation for a guide to creating a DSN on your OS.

Adobe Analytics uses the OAuth authentication standard. To authenticate using OAuth, you will need to create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See the "Getting Started" section of the help documentation for a guide.

Retrieving GlobalCompanyId

GlobalCompanyId is a required connection property. If you do not know your Global Company ID, you can find it in the request URL for the users/me endpoint on the Swagger UI. After logging into the Swagger UI Url, expand the users endpoint and then click the GET users/me button. Click the Try it out and Execute buttons. Note your Global Company ID shown in the Request URL immediately preceding the users/me endpoint.

Retrieving Report Suite Id

Report Suite ID (RSID) is also a required connection property. In the Adobe Analytics UI, navigate to Admin -> Report Suites and you will get a list of your report suites along with their identifiers next to the name.

After setting the GlobalCompanyId, RSID and OAuth connection properties, you are ready to connect to Adobe Analytics.

Below is the syntax for a DSN:

[CData AdobeAnalytics Source] Driver = CData ODBC Driver for Adobe Analytics Description = My Description GlobalCompanyId = myGlobalCompanyId RSID = myRSID OAuthClientId = myOauthClientId OauthClientSecret = myOAuthClientSecret CallbackURL = myCallbackURL

Adobe Analytics へのクエリの実行

Instantiate a Cursor and use the execute method of the Cursor class to execute any SQL statement.

import pyodbc cnxn = pyodbc.connect('DRIVER={CData ODBC Driver for AdobeAnalytics};GlobalCompanyId = myGlobalCompanyId; RSID = myRSID; OAuthClientId = myOauthClientId; OauthClientSecret = myOAuthClientSecret; CallbackURL = myCallbackURL;') cursor = cnxn.cursor() cursor.execute("SELECT Page, PageViews FROM AdsReport WHERE City = 'Chapel Hill'") rows = cursor.fetchall() for row in rows: print(row.Page, row.PageViews)

After connecting to Adobe Analytics in PyCharm using the CData ODBC Driver, you will be able to build Python apps with access to Adobe Analytics data as if it were a standard database. If you have any questions, comments, or feedback regarding this tutorial, please contact us at