Connect and validate

This use case sets up the connection from the BI tool to Customer Journey Analytics, lists the available data views, and selects a data view to use.

Customer Journey Analytics

The instructions refer to an example environment with the following objects:

  • Data view: C&C - Data View πŸ….
  • Dimensions: Product Name πŸ…‘ and Product Category πŸ…’.
  • Metrics: Purchase Revenue πŸ…“ and Purchases πŸ…”.
  • Filter: Fishing Products πŸ…•.

Customer Journey Analytics Base setup

When you go through the use cases, replace these example objects with objects that are appropriate for your specific environment.

BI tools
tabs
Power BI Desktop
  1. Access the required credentials and parameters from the Experience Platform Query Service UI.

    1. Navigate to your Experience Platform sandbox.

    2. Select Queries Queries from the left rail.

    3. Select Credentials tab in the Queries interface.

    4. Select prod:cja from the Database drop-down menu.

      Query service credentials

  2. Start Power BI Desktop.

    1. From the main interface, select Get data from other sources.

    2. In the Get Data dialog:
      PowerBI PostgreSQL database

      1. Search for and select PostgreSQL database.
      2. Select Connect.
    3. In the PostgreSQL database dialog:
      PowerBI Desktop Server and Database settings

      1. Use Copy to copy and paste the Host and Port values from the Experience Platform Query Expiring Credentials panel, separated by : as the value for Server. For example: examplecompany.platform-query.adobe.io:80.
      2. Use Copy to copy and paste the Database value from the Experience Platform Query Expiring Credentials panel. Add ?FLATTEN to the value that you paste. For example, prod:cja?FLATTEN.
      3. Select DirectQuery as the Data connectivity mode.
      4. Select OK.
    4. In the PostgreSQL database - Database dialog:
      PowerBI Desktop User and Password

      1. Use Copy to copy the Username and Password values from the Experience Platform Query Expiring Credentials panel in the User name and Password fields. If you are using a non-expiring credential, use the password of your non-expiring credential.
      2. Ensure that the drop-down menu for Select which level to apply these settings to is set to the Server that you have defined earlier.
      3. Select Connect.
    5. In the Navigator dialog, the data views are retrieved. This retrieval can take some time. Once retrieved, you see the following in Power BI Desktop.
      Power BI Destkop Load Data

      1. Select public.cc_data_view from the list in the left panel.

      2. You have two options:

        1. Select Load to continue and finish the setup.
        2. Select Transform Data. You see a dialog where you can optionally apply transformations as part of the configuration.
          Power BI Desktop Transform Data
          • Select Close & Apply.
    6. After a while, public.cc_data_view is displayed in the Data pane. Select ChevronRight to show dimensions and metrics.
      Power BI Destkop Server Data Loaded

To FLATTEN or not

Power BI Desktop supports the following scenarios for the FLATTEN parameter. See Flatten nested data for more information.

table 0-row-4 1-row-4 2-row-4 3-row-4 3-align-center 8-align-center 13-align-center 18-align-center
FLATTEN parameter Example Supported Remarks
None prod:cja CheckmarkCircle
?FLATTEN prod:cja?FLATTEN CheckmarkCircle Recommended option to use!
%3FFLATTEN prod:cja%3FFLATTEN CloseCircle Power BI Desktop displays error: We couldn’t authenticate with the credentials provided. Please try again.

More information

Tableau Desktop
  1. Access the required credentials and parameters from the Experience Platform Query Service UI.

    1. Navigate to your Experience Platform sandbox.

    2. Select Queries Queries from the left rail.

    3. Select Credentials tab in the Queries interface.

    4. Select prod:cja from the Database drop-down menu.

      Query service credentials

  2. Start Tableau.

    1. Select PostgreSQL from the left rail underneath To a Server. If not available, select More… and select PostgreSQL from the Installed Connectors.
      Tableau Connectors

    2. In the PostgreSQL dialog, in the General tab:
      Tableau Sign In dialog

      1. Use Copy to copy and paste the Host from the Experience Platform Query Expiring Credentials panel to the Server.
      2. Use Copy to copy and paste the Port from the Experience Platform Query Expiring Credentials panel to the Port.
      3. Use Copy to copy and paste the Database from the Experience Platform Query Expiring Credentials panel to the Database. Add %3FFLATTEN to the value that you paste. For example: prod:cja%3FFLATTEN.
      4. Select Username and Password from the Authentication drop-down menu.
      5. Use Copy to copy and paste the Username from the Experience Platform Query Expiring Credentials panel to the Username.
      6. Use Copy to copy and paste the Password from the Experience Platform Query Expiring Credentials panel to the Password. If you are using a non-expiring credential, use the password of your non-expiring credential.
      7. Ensure that Require SSL is checked.
      8. Select Sign In.

      You see a Progressing Request dialog while Tableau Desktop validates the connection.

    3. In the main window, you see in the Data Source page, in the left pane:

      • The name of the connection, underneath Connections.
      • The name of the database, underneath Database.
      • A list of tables, underneath Table.
        Tableau Connected
      1. Drag the cc_data_view entry and drop the entry on the main view that reads Drag tables here.
    4. The main window displays details of the cc_data_view data view.
      Tableau Connected

To FLATTEN or not

Tableau Desktop supports the following scenarios for the FLATTEN parameter. See Flatten nested data for more information.

table 0-row-4 1-row-4 2-row-4 3-row-4 3-align-center 8-align-center 13-align-center 18-align-center
FLATTEN parameter Example Supported Remarks
None prod:cja CheckmarkCircle
?FLATTEN prod:cja?FLATTEN CheckmarkCircle
%3FFLATTEN prod:cja%3FFLATTEN CheckmarkCircle Recommended option to use. Note, %3FFLATTEN is URL-encoded version of ?FLATTEN.

More information

Looker
  1. Access the required credentials and parameters from the Experience Platform Query Service UI.

    1. Navigate to your Experience Platform sandbox.

    2. Select Queries Queries from the left rail.

    3. Select Credentials tab in the Queries interface.

    4. Select prod:cja from the Database drop-down menu.

      Query service credentials

  2. Log in to Looker

    1. Select Admin from the left rail.

    2. Select Connections.

    3. Select Add Connection.

    4. In the Connect your database to Looker screen.

      Looker Connect to database

      1. Enter a Name for your connection, for example Example Looker Connection.
      2. Ensure All Projects is selected as the Connection Scope.
      3. Select PostgreSQL 9.5+ as the Dialect.
      4. Use Copy to copy and paste the Host value from the Experience Platform Query Expiring Credentials panel, as the value for Host. For example: examplecompany.platform-query.adobe.io.
      5. Use Copy to copy and paste the Port value from the Experience Platform Query Expiring Credentials panel, as the value for Port. For example: 80.
      6. Use Copy to copy and paste the Database value from the Experience Platform Query Expiring Credentials panel as the value for Database. Add %3FFLATTEN to the value that you paste. For example, prod:cja%3FFLATTEN.
      7. Use Copy to copy and paste the Username value from the Experience Platform Query Expiring Credentials panel as the value for Username.
      8. Use Copy to copy and paste the Password value from the Experience Platform Query Expiring Credentials panel as the value for Password.
      9. Select Expand all at Optional Settings.
      10. Set Max connections per node to 5.
      11. Ensure SSL is enabled.
      12. Select Test to test the connection. You should see a banner appear at the top of the screen with a message like Success, can connect JDBC ….
      13. Select Connect to establish and save the connection.
    5. You see the new connection in the Connections interface.

    6. Select ← from Admin to go to main navigation in the left rail.

    7. Select Develop.

    8. Select Projects.

    9. Select New Model in LookML Projects.

    10. To ensure you do not affect other users. select Enter Development Mode, when prompted.

    11. In the Create Model experience:

      1. In ➊ Select Database Connection:

        1. Select your database connection in Select database connection. For example: example_looker_connection.
        2. Name your project in Create a new LookML Project for this model. For example: example_looker_project.
        3. Select Next.
      2. In βž‹ Select Tables:

        1. Select public and then ensure your Customer Journey Analytics data view is selected. For example: SelectBox cc_data_view.
        2. Select Next.
      3. In ➌ Select Primary Keys:

        1. Select Next.
      4. In ➍ Select Explores to Create:

        1. Ensure you select your view. For example: cc_data_view.view.
        2. Select Next.
      5. In ➎ Enter Model Name:

        1. Name your model. For example: example_looker_model.
      6. Select Complete and Explore Data.

    You are redirected to the Explore interface of Looker, ready to explore the data.

To FLATTEN or not

Looker supports the following scenarios for the FLATTEN parameter. See Flatten nested data for more information.

table 0-row-4 1-row-4 2-row-4 3-row-4 3-align-center 8-align-center 13-align-center 18-align-center
FLATTEN parameter Example Supported Remarks
None prod:cja CheckmarkCircle
?FLATTEN prod:cja?FLATTEN CheckmarkCircle
%3FFLATTEN prod:cja%3FFLATTEN CheckmarkCircle Recommended option to use. Note, %3FFLATTEN is URL-encoded version of ?FLATTEN.

More information

Jupyter Notebook
  1. Access the required credentials and parameters from the Experience Platform Query Service UI.

    1. Navigate to your Experience Platform sandbox.

    2. Select Queries Queries from the left rail.

    3. Select Credentials tab in the Queries interface.

    4. Select prod:cja from the Database drop-down menu.

      Query service credentials

  2. Ensure you have set up a dedicated Python virtual environment for running your Jupyter Notebook environment.

  3. Ensure you have installed the required libraries in your virtual environment:

    • ipython-sql: pip install ipython-sql.
    • psycopg2-binary: pip install psycopg-binary.
    • sqlalchemy: pip install sqlalchemy.
  4. Start Jupyter Notebook from your virtual environment: jupyter notebook.

  5. Create a new notebook, or download this sample notebook.

  6. In your first cell, enter and execute:

    code language-none
    %config SqlMagic.style = '_DEPRECATED_DEFAULT'
    
  7. In a new cell, enter the config parameters for your connection. Use Copy to copy and paste values from the Experience Platform Query Expiring Credentials panel to the values required for the config parameters. For example:

    code language-none
    import ipywidgets as widgets
    from IPython.display import display
    
    config_host = widgets.Text(description='Host:', value='example.platform-query-stage.adobe.io',
                            layout=widgets.Layout(width="600px"))
    display(config_host)
    config_port = widgets.IntText(description='Port:', value=80,
                               layout=widgets.Layout(width="200px"))
    display(config_port)
    config_db = widgets.Text(description='Database:', value='prod:cja',
                          layout=widgets.Layout(width="300px"))
    display(config_db)
    config_username = widgets.Text(description='Username:', value='EC582F955C8A79F70A49420E@AdobeOrg',
                                layout=widgets.Layout(width="600px"))
    display(config_username)
    config_password = widgets.Password(description='Password:', value='***',
                                    layout=widgets.Layout(width="600px"))
    display(config_password)
    
  8. Execute the cell.

  9. Use Copy to copy and paste the password from the Experience Platform Query Expiring Credentials panel to the Password field in Jupyter Notebook.

    Jupter Notebook Config Step 1

  10. In a new cell, enter the statements to load the SQL extension, the required library and connect with Customer Journey Analytics.

    code language-python
    %load_ext sql
    from sqlalchemy import create_engine
    %sql postgresql://{config_username.value}:{config_password.value}@{config_host.value}:{config_port.value}/{config_db.value}?sslmode=require
    

    Execute the shell. You should see no output but the cell should execute without any warning.

    Jupyer Notebook Config Step 4

  11. In a new call, enter the statements to get a list of available data views based on the connection.

    code language-python
    %%sql
    SELECT n.nspname as "Schema",
       c.relname as "Name",
       CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 't' THEN 'TOAST table' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN 'partitioned index' END as "Type",
       pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
    FROM pg_catalog.pg_class c
    LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
    WHERE c.relkind IN ('v','')
       AND n.nspname <> 'pg_catalog'
       AND n.nspname !~ '^pg_toast'
       AND n.nspname <> 'information_schema'
       AND pg_catalog.pg_table_is_visible(c.oid)
       AND c.relname NOT LIKE '%test%'
       AND c.relname NOT LIKE '%ajo%'
    ORDER BY 1,2;
    

    Execute the shell. You should see output simular to the screenshot below.

    Jupyter Notebook Config Step 5

    You should see the cc_data_view in the list of data views.

To FLATTEN or not

Jupyter Notebook supports the following scenarios for the FLATTEN parameter. See Flatten nested data for more information.

table 0-row-4 1-row-4 2-row-4 3-row-4 3-align-center 8-align-center 13-align-center 18-align-center
FLATTEN parameter Example Supported Remarks
None prod:cja CheckmarkCircle
?FLATTEN prod:cja?FLATTEN CloseCircle
%3FFLATTEN prod:cja%3FFLATTEN CheckmarkCircle Recommended option to use. Note, %3FFLATTEN is URL-encoded version of ?FLATTEN.

More information

RStudio
  1. Access the required credentials and parameters from the Experience Platform Query Service UI.

    1. Navigate to your Experience Platform sandbox.

    2. Select Queries Queries from the left rail.

    3. Select Credentials tab in the Queries interface.

    4. Select prod:cja from the Database drop-down menu.

      Query service credentials

  2. Start RStudio.

  3. Create a new R Markdown file, or download this example R markdown file.

  4. In your first chunk, enter the following statements between ```{r} and ```. Use Copy to copy and paste values from the Experience Platform Query Expiring Credentials panel to the values required for the various parameters, like host, dbname, and user. For example:

    code language-r
    library(rstudioapi)
    library(DBI)
    library(dplyr)
    library(tidyr)
    library(RPostgres)
    library(ggplot2)
    
    host <- rstudioapi::showPrompt(title = "Host", message = "Host", default = "orangestagingco.platform-query-stage.adobe.io")
    dbname <- rstudioapi::showPrompt(title = "Database", message = "Database", default = "prod:cja?FLATTEN")
    user <- rstudioapi::showPrompt(title = "Username", message = "Username", default = "EC582F955C8A79F70A49420E@AdobeOrg")
    password <- rstudioapi::askForPassword(prompt = "Password")
    
  5. Run the chunk. You are prompted for Host, Database, and User. Simply accept the values you have provided as part of the previous step.

  6. Use Copy to copy and paste the password from the Experience Platform Query Expiring Credentials panel to the Password dialog prompt in RStudio.

    RStudio config step 1

  7. Create a new chunk and enter the following statements between ``` {r} and ```.

    code language-r
    con <- dbConnect(
       RPostgres::Postgres(),
       host = host,
       port = 80,
       dbname = dbname,
       user = user,
       password = password,
       sslmode = 'require'
    )
    
  8. Run the chunk. You should see no output if the connection is successful.

  9. Create a new chunk and enter the following statements between ``` {r} and ```.

    code language-r
    views <- dbListTables(con)
    print(views)
    
  10. Run the chunk. You should see character(0) as the only output.

  11. Create a new chunk and enter the following statements between ``` {r} and ```.

    code language-r
    glimpse(dv)
    
  12. Run the chunk. You should see output simular to the screenshot below.

    RStudio config step 2

To FLATTEN or not

RStudio supports the following scenarios for the FLATTEN parameter. See Flatten nested data for more information.

table 0-row-4 1-row-4 2-row-4 3-row-4 3-align-center 8-align-center 13-align-center 18-align-center
FLATTEN parameter Example Supported Remarks
None prod:cja CheckmarkCircle
?FLATTEN prod:cja?FLATTEN CheckmarkCircle Recommended option to use.
%3FFLATTEN prod:cja%3FFLATTEN CloseCircle

More information

recommendation-more-help
080e5213-7aa2-40d6-9dba-18945e892f79