Get Started

This tutorial will show you how to use our FORT Research Platform web app to perform a basic SQL query against the Facebook Ads Targeting dataset.

Before You Start

Step 1: Log in

While connected to our VPN, visit the FORT Research Platform URL that was emailed to you and log into the site using your Facebook credentials. This will spin up a Jupyter Notebook server instance for your use.

Step 2: Create a notebook

Click the New dropdown menu and select Python3. This will create a new Jupyter Notebook in a new browser tab. Rename the Notebook if you wish.

The 'New' dropdown menu in Jupyter Hub showing 'Python 3' as an option.

Step 3: Import the query module

Import our query module (execute) by clicking in an empty In[ ] Notebook cell and enter the following code:

from fbri.private.sql.query import execute

Run the code by clicking the >| Run button. You won't see anything happen, but a new In[ ] Nobtebook cell will appear when it finishes importing.

Step 4: Create a SQL query and run it

Enter the following code in the new, empty In[ ] Notebook cell:

database = "fbri_prod_atp"
table = "ad_library_targeting"
sql = f"SELECT * FROM {database}.{table} LIMIT 5"
 
execute(sql)

This defines a SQL query (sql) using variable substitution (database and table), then uses the query module to execute the query.

Run the code. This should return a dataframe of your results (screenshot of dataframe results blurred intentionally).

Sample SQL query selecting all rows from ad_library_targeting table and results returned as a dataframe.

You can scroll within the dataframe to see additional table columns.

Next Steps

If you are able to perform the query above, you are able to perform a basic search using our web app. We recommend that you now read a few sample queries to get an idea of how to build your own custom queries.