TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

DATA ENGINEERING

Creating a Database Front End with Deepnote

6 min readApr 1, 2022

--

Photo by Sebastian Coman Photography on Unsplash

Enter Deepnote

Deepnote (Source)
import json
import os
from google.oauth2 import service_account
from google.cloud import bigquery
bq_credentials = service_account.Credentials.from_service_account_info(
json.loads(os.environ[‘INTEGRATION_NAME_SERVICE_ACCOUNT’]))
client = bigquery.Client(credentials=bq_credentials,
project=bq_credentials.project_id)
Automated data extraction & transformation with Ramsey
Reporting process flowchart

Implementing the Front End

Parent class with SQL template
Generating SQL code with Python
Child class with specific dimensions and metrics
import pandas as pd
from pipeline import Pipeline
from platforms import FacebookAdsPipeline
# Creating a dictionary to pass into the pipeline
params = {
"start_date": "2021-10-01",
"end_date": "2021-12-24",
"campaign_identifier": "123123123",
"campaign_name": "2022_Q1_Campaign_Name",
"output_file_type": "csv" # Options are .csv / .xlsx
}
# Passing in parameters & extracting data via BigQuery SQL
fb = FacebookAdsPipeline(**params)
df = fb.extract()
df.to_csv("output.csv")
Extracting data with the grandparent class
Front-end options: low code & high code

Preparing for the Future

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Responses (1)