Ready to get started?

Download a free trial of the Adobe Analytics ODBC Driver to get started:

 Download Now

Learn more:

Adobe Analytics Icon Adobe Analytics ODBC Driver

The Adobe Analytics ODBC Driver is a powerful tool that allows you to connect with live Adobe Analytics data, directly from any applications that support ODBC connectivity.

Access Adobe Analytics like you would a database - access Metrics, Users, Reports, Segments, etc. through a standard ODBC Driver interface.

Using the CData ODBC Driver for Adobe Analytics in PyCharm



Connect to Adobe Analytics as an ODBC data source in PyCharm using the CData ODBC Driver for Adobe Analytics.

The CData ODBC Drivers can be used in any environment that supports loading an ODBC Driver. In this tutorial we will explore using the CData ODBC Driver for Adobe Analytics from within PyCharm. Included are steps for adding the CData ODBC Driver as a data source, as well as basic PyCharm code to query the data source and display results.

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

Add Pyodbc to the Project

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.

Connect to 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

Execute SQL to 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 support@cdata.com.