repo_name stringclasses 5
values | repo_url stringclasses 5
values | repo_description stringclasses 3
values | repo_stars int64 6 15.8k | repo_forks int64 192 3.6k | repo_last_updated stringclasses 5
values | repo_created_at stringclasses 5
values | repo_size int64 513 2.13k | repo_license stringclasses 4
values | language stringclasses 2
values | text stringlengths 0 27.5k | avg_line_length float64 0 74.3 | max_line_length int64 0 652 | alphnanum_fraction float64 0 0.8 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class CreateTableOperator(BaseOperator):
ui_color = '#358140'
@apply_defaults
def __init__(self, redshift_conn_id = "", *args, **kwargs):
super... | 26.7 | 80 | 0.651807 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class DataQualityOperator(BaseOperator):
ui_color = '#89DA59'
@apply_defaults
def __init__(self,
redshift_conn_id="",
tables =... | 36.823529 | 94 | 0.595331 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadDimensionOperator(BaseOperator):
ui_color = '#80BD9E'
@apply_defaults
def __init__(self,
redshift_conn_id="",
sql_qu... | 36.65625 | 116 | 0.622924 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadFactOperator(BaseOperator):
ui_color = '#F98866'
@apply_defaults
def __init__(self,
redshift_conn_id="",
sql_query =... | 27.416667 | 78 | 0.621145 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.contrib.hooks.aws_hook import AwsHook
class StageToRedshiftOperator(BaseOperator):
ui_color = '#358140'
copy_query = " COPY {} \
FROM '{}' \
... | 37.280702 | 141 | 0.577258 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import configparser
from pathlib import Path
config = configparser.ConfigParser()
config.read_file(open(f"{Path(__file__).parents[0]}/config.cfg"))
api_key = config['KEYS']['API_KEY']
headers = {'Authorization': 'Bearer %s' % api_key} | 28.625 | 65 | 0.711864 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | # This is request module of this project
from request import Request
from auth import headers
import json
class BusinessSearch:
def __init__(self, term, location, price=None):
self._param = {'term' : term, 'location' : location}
if price:
self._param['price'] = price
self._base_... | 47.512821 | 139 | 0.615547 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import psycopg2
import configparser
from pathlib import Path
from queries import create_business_schema, create_business_table
config = configparser.ConfigParser()
config.read_file(open(f"{Path(__file__).parents[0]}/config.cfg"))
class DatabaseDriver:
def __init__(self):
self._conn = psycopg2.connect("ho... | 30.8 | 123 | 0.685039 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import configparser
from pathlib import Path
from businesssearch import BusinessSearch
from queries import create_business_schema, create_business_table, insert_business_table
from databasedriver import DatabaseDriver
import argparse
config = configparser.ConfigParser()
config.read_file(open(f"{Path(__file__).parents[... | 44.690476 | 148 | 0.657977 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | create_business_schema = """CREATE SCHEMA IF NOT EXISTS yelp;"""
create_business_table = """
CREATE TABLE IF NOT EXISTS yelp.business (
business_id varchar PRIMARY KEY,
business_name varchar,
image_url varchar,
url varchar,
review_count int,
categories varchar,
rating float,
latitude float,
longitude float,
... | 35.371429 | 124 | 0.505503 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import requests
from auth import headers
import json
class Request:
def __init__(self):
self._header = headers
@staticmethod
def get_content(url, param):
response = requests.get(url, headers=headers, params=param)
if response.status_code == 200:
return json.loads(respo... | 27.875 | 90 | 0.635575 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import configparser
import psycopg2
from sql_queries import copy_table_queries, insert_table_queries
def load_staging_tables(cur, conn):
for query in copy_table_queries:
cur.execute(query)
conn.commit()
def insert_tables(cur, conn):
for query in insert_table_queries:
cur.execute(quer... | 20.625 | 112 | 0.638205 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def drop_tables(cur, conn):
for query in drop_table_queries:
cur.execute(query)
conn.commit()
def create_tables(cur, conn):
for query in create_table_queries:
cur.execute(query)
... | 20 | 112 | 0.636364 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | from create_tables import main as create_table_main
from etl import main as etl_main
if __name__ == "__main__":
create_table_main()
etl_main()
| 20.857143 | 51 | 0.664474 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import boto3
import configparser
from botocore.exceptions import ClientError
import json
import logging
import logging.config
from pathlib import Path
import argparse
import time
# Setting up logger, Logger properties are defined in logging.ini file
logging.config.fileConfig(f"{Path(__file__).parents[0]}/logging.ini")... | 42.537267 | 192 | 0.657868 |
Udacity-Data-Engineering-Projects | https://github.com/san089/Udacity-Data-Engineering-Projects | Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development. | 1,219 | 433 | 2023-12-04 20:08:27+00:00 | 2020-01-20 22:50:03+00:00 | 2,128 | Other | Python | import psycopg2
import configparser
# Loading cluster configurations from cluster.config
config = configparser.ConfigParser()
config.read_file(open('cluster.config'))
def test_connection(host):
dbname = config.get('DWH','DWH_DB')
port = config.get('DWH','DWH_PORT')
user = config.get('DWH','DWH_DB_USER')... | 28.590909 | 95 | 0.683077 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | 0 | 0 | 0 | |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import json
from concurrent.futures import ThreadPoolExecutor
from retry import RetryOnException as retry
from proxypool import (
ProxyPoolValidator,
ProxyPoolScraper,
RedisProxyPoolClient
)
from airflow.models.baseoperator import BaseOperator
from airflow.utils.decorators import apply_defaults
class Pro... | 31.160714 | 79 | 0.611111 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from log import log
from retry import RetryOnException as retry
from proxypool import RedisProxyPoolClient
from rss_news import (
NewsProducer,
NewsExporter,
NewsValidator
)
from airflow.models.baseoperator import BaseOperator
from airflow.utils.decorators import apply_defaults
@log
class RSSNewsOperator... | 29.293103 | 71 | 0.573462 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python |
class Config:
PROXY_WEBPAGE = "https://free-proxy-list.net/"
TESTING_URL = "https://google.com"
REDIS_CONFIG = {
"host": "redis",
"port": "6379",
"db": 0
}
REDIS_KEY = "proxies"
MAX_WORKERS = 50
NUMBER_OF_PROXIES = 50
RSS_FEEDS = {
"en": [
... | 23.280702 | 68 | 0.484454 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from urllib.parse import urlparse
from datetime import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from dags_config import Config as config
from custom_operators import (
ProxyPoolOperator,
RSSNewsOperator
)
def extract_feed_name(url):
parsed_url = urlpar... | 25.861702 | 66 | 0.604596 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import logging
class Logger:
__register = False
def __init__(self):
if not self.__register:
self._init_default_register()
def _init_default_register(self):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
Logger.__register = True
logging.info... | 20.083333 | 50 | 0.613861 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python |
headers_list = [
{
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Referer": "https://www.google.com/",
... | 42.609756 | 146 | 0.564633 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python |
import re
import random
from contextlib import closing
from requests import get
from log import log
from parser.random_headers_list import headers_list
@log
class WebParser:
def __init__(self, website_url, rotate_header=True):
self.url = website_url
self._rotate_header = rotate_header
def ge... | 26.934783 | 63 | 0.566199 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from bs4 import BeautifulSoup
from dataclasses import dataclass, field
from parser import WebParser
from log import log
@dataclass
class ProxyRecord:
ip_address: str
port: int
country_code: str
country: str
anonymity: str
google: str
https: str
last_checked: str
proxy: dict = field... | 25.103448 | 61 | 0.58427 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import time
from dataclasses import dataclass
from parser import WebParser
from log import log
@dataclass(frozen=True)
class ProxyStatus:
proxy: str
health: float
is_valid: bool
@log
class ProxyPoolValidator:
def __init__(self, url, timeout=10, checks=3, sleep_interval=0.1):
self.timeout = t... | 26.775 | 70 | 0.616216 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import json
import redis
from log import log
@log
class RedisProxyPoolClient:
def __init__(self, key, redis_config):
self.key = key
self.redis = redis.StrictRedis(
**redis_config
)
def __enter__(self):
return self
def override_existing_proxies(self, proxies):
... | 24.5 | 66 | 0.594393 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import functools
from log import log
@log
class RetryOnException:
def __init__(self, retries):
self._retries = retries
def __call__(self, function):
functools.update_wrapper(self, function)
def wrapper(*args, **kwargs):
self.logger.info(f"Retries: {self._retries}")
... | 28 | 64 | 0.527043 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import json
import time
from kafka import KafkaProducer
class NewsExporter:
def __init__(self, bootstrap_servers):
self._producer = self._connect_producer(
bootstrap_servers
)
def _connect_producer(self, bootstrap_servers):
def encode_news(value):
return json.d... | 23.432432 | 68 | 0.581395 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import re
from dataclasses import dataclass
import atoma
from parser import WebParser
@dataclass(frozen=True)
class News:
_id: str
title: str
link: str
published: str
description: str
author: str
language: str
def as_dict(self):
return self.__dict__
class NewsProducer:
d... | 26.945946 | 71 | 0.610547 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python |
class NewsValidator:
def __init__(self, config):
self._config = config
def validate_news(self, news):
news = news.as_dict()
assert self.check_languages(news), "Wrong language!"
assert self.check_null_values(news), "Null values!"
assert self.check_description_length(new... | 30.333333 | 72 | 0.620118 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from pkg_resources import resource_string
import pytest
import fakeredis
from parser import WebParser
from requests import Response
from rss_news import NewsProducer, NewsFormatter, NewsValidator, News
from proxypool import ProxyPoolScraper, ProxyRecord
from retry import RetryOnException as retry
TEST_URL = "https:/... | 15.708333 | 69 | 0.590818 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from proxypool import ProxyRecord
from unittest.mock import patch
from ..fixtures import web_parser, scraper, raw_content
@patch("parser.web_parser.WebParser.get_content")
def test_get_proxy_stream(get_content, raw_content, web_parser, scraper):
get_content.return_value = raw_content("proxy_list_file.txt")
... | 26.352941 | 73 | 0.741379 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from unittest.mock import patch
from proxypool import ProxyPoolValidator
from ..fixtures import web_parser, raw_content, proxy_record
@patch("parser.web_parser.WebParser.get_content")
def test_validate_proxy(get_content, raw_content, web_parser, proxy_record):
expected = True
get_content.return_value = raw_... | 33.177419 | 84 | 0.725685 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import json
from unittest.mock import patch
from proxypool import RedisProxyPoolClient
from ..fixtures import redis_config, redis_mock, proxies
@patch("proxypool.redis_proxypool_client.redis.StrictRedis")
def test_override_existing_proxies(redis, redis_config, redis_mock, proxies):
new_proxies = [{"http": "http:... | 28.486486 | 87 | 0.695552 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import pytest
from ..fixtures import add_function
def test_retry_on_exception_valid(add_function):
expected = 2
result = add_function(1, 1)
assert result == expected
def test_retry_on_exception_wrong(add_function):
with pytest.raises(TypeError):
add_function("Test", 0.0001)
| 16.111111 | 48 | 0.690554 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from unittest.mock import patch, Mock
import pytest
from rss_news import NewsExporter
@patch("rss_news.rss_news_exporter.KafkaProducer")
def test_connect_producer(mock_producer):
exporter = NewsExporter(["test_broker:9092"])
assert exporter._producer is not None
@patch("rss_news.NewsExporter")
def test_ex... | 24.843137 | 62 | 0.601367 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import datetime
from unittest.mock import patch
import pytest
from rss_news import News
from ..fixtures import web_parser, raw_content, producer, proxies, formatter
@patch("parser.web_parser.WebParser.get_content")
def test_get_news_stream(get_content, web_parser, raw_content, producer, proxies):
get_content.re... | 26.657534 | 82 | 0.68335 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import pytest
from rss_news import News
from ..fixtures import validator, news_record
def test_check_null_values(validator, news_record):
expected = True
news = news_record.as_dict()
result = validator.check_null_values(news)
assert result is expected
def test_check_null_values_with_nones(va... | 19.095238 | 62 | 0.69395 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from unittest.mock import patch
import pytest
from pytest import fixture
from requests.exceptions import ConnectionError
from parser import WebParser
from ..fixtures import web_parser, response
@patch("parser.web_parser.get")
def test_get_content(mock_get, web_parser):
expected = "TEST CONTENT"
mock_g... | 22.985507 | 71 | 0.674123 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | """
Django settings for core project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Buil... | 24.912088 | 91 | 0.627784 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.urls import path
from users.views import UserCreateView, ObtainTokenView
app_name = "user"
urlpatterns = [
path("register/", UserCreateView.as_view(), name="register"),
path("login/", ObtainTokenView.as_view(), name="login")
]
| 21.818182 | 65 | 0.712 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | """
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS... | 21.705882 | 78 | 0.766234 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportErr... | 27.409091 | 73 | 0.655449 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from rest_framework import routers
from django.contrib import admin
from rest_framework.authtoken.models import Token
from news.models import News
from news.urls import urlpatterns
from users.models import UserModel
class NewsAdminSite(admin.AdminSite):
def get_urls(self):
urls = super(NewsAdminSite,... | 24 | 52 | 0.753817 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
| 13.333333 | 33 | 0.741176 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.db import models
from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin
)
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **kwargs):
if not email:
raise ValueError("Must have an email address")
email... | 27.027027 | 58 | 0.666023 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.contrib.auth import authenticate
from rest_framework import serializers
from rest_framework.authtoken.models import Token
from users.models import UserModel
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = UserModel
fields = ("email", "password")
extra_k... | 23.614035 | 67 | 0.560628 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.test import TestCase
from django.urls.resolvers import URLResolver
from news.admin import NewsAdminSite
class TestAdminSite(TestCase):
def setUp(self):
self.admin_site = NewsAdminSite()
def test_api_urls_in_admin_site(self):
expected = "'api/'"
urls_objects = s... | 22.347826 | 70 | 0.641791 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
ADMIN_SEARCH_NEWS_URL = reverse("admin:news-list")
ADMIN_SEARCH_NEWS_URL = reverse(
"admin:news-detail", kwargs={"_id":"missi... | 24.515152 | 62 | 0.693222 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.test import TestCase
from news.models import News
class NewsModelTests(TestCase):
TEST_NEWS_DATA = {
"_id": "test_id",
"title": "test titile",
"link": "www.testnews.com",
"published": "2020-01-01 00:00:00",
"description": "test description",
"author": "... | 23.088235 | 57 | 0.564792 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from rest_framework import generics
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from users.serializers import UserSerializer, AuthTokenSerializer
class UserCreateView(generics.CreateAPIView):
serializer_class = UserSerializer
permission_classes... | 24.15 | 65 | 0.804781 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | import os
from elasticsearch_dsl import analyzer
from django_elasticsearch_dsl import Document, fields, Index
from elasticsearch_dsl import analyzer
from news.models import News
news_index = Index(os.environ["ELASTIC_INDEX"])
news_index.settings(
number_of_shards=1,
number_of_replicas=1
)
html_strip = anal... | 20.545455 | 60 | 0.617399 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from elasticsearch.exceptions import NotFoundError
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
SEARCH_NEWS_URL = reverse("search:search-list")
SEARCH_DETAIL_NEWS_URL = rever... | 24.666667 | 62 | 0.645874 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse("user:register")
GET_TOKEN_URL = reverse("user:login")
class UserApiTests(TestCase):
def setUp(s... | 28.858696 | 72 | 0.583394 |
DataEngineeringProject | https://github.com/damklis/DataEngineeringProject | Example end to end data engineering project. | 920 | 192 | 2023-12-04 19:31:15+00:00 | 2020-06-30 09:33:56+00:00 | 1,845 | MIT License | Python | from django.test import TestCase
from django.contrib.auth import get_user_model
class UserModelTests(TestCase):
email = "testemail@test.com"
email_upper = "testemail@TESTUPPER.COM"
password = "testpassword"
def test_create_user_check_email(self):
user = get_user_model().objects.create_user(
... | 28.659574 | 62 | 0.612347 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 26.276224 | 313 | 0.683205 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 27.69697 | 321 | 0.670061 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 37.485356 | 490 | 0.684897 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 48.116071 | 529 | 0.72135 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 38.604502 | 549 | 0.725317 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 40.638806 | 432 | 0.726627 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 56.163043 | 500 | 0.732408 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md
# MAGIC # Exploring the Results of a DLT Pipeline
# MAGIC
# MAGIC This Notebook explores the execution results of a DLT pipeline.
# COMMAND ----------
# MAGIC %run ../Includes/dlt-setup $course="dlt_demo"
# COMMAND ----------
storage_location = userhome
# COMMAND ---------... | 18.581818 | 77 | 0.642193 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 29.223881 | 192 | 0.700914 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 27.747423 | 192 | 0.698888 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 42.010582 | 333 | 0.71469 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 62.801724 | 652 | 0.746757 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 45.204082 | 215 | 0.70084 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 61.5 | 281 | 0.732127 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ../../Includes/dlt-setup
# COMMAND ----------
File.newData()
# COMMAND ----------
# MAGIC %md
# MAGIC ## Create and Configure a Pipeline
# MAGIC
# MAGIC **NOTE**: This lab is configured to work with the DLT pipeline completed as part of the DLT lab in the previous module. ... | 45.638889 | 256 | 0.70143 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ../../Includes/dlt-setup
# COMMAND ----------
# MAGIC %md
# MAGIC # Exploring the Results of a DLT Pipeline
# MAGIC
# MAGIC This Notebook explores the execution results of a DLT pipeline. Before proceeding, you will need one piece of information specific to your pipeline ins... | 29.68254 | 379 | 0.700311 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 69.321839 | 297 | 0.726827 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 48.063973 | 445 | 0.729874 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 42.068627 | 418 | 0.708253 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 39.430147 | 471 | 0.715442 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 44.786477 | 482 | 0.730198 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ../../Includes/dlt-setup
# COMMAND ----------
File.newData()
| 11 | 37 | 0.616822 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
import pyspark.sql.functions as F
import re
course_name = "eltsql"
username = spark.sql("SELECT current_user()").first()[0]
clean_username = re.sub("[^a-zA-Z0-9]", "_", username)
database = f"""{clean_username}_dbacademy_{course_name}"""
userhome = f"dbfs:/user/{username}/dbacademy/{cours... | 27.090909 | 59 | 0.696921 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
for stream in spark.streams.active:
stream.stop()
# COMMAND ----------
import pyspark.sql.functions as F
import re
course_name = "dewd"
username = spark.sql("SELECT current_user()").first()[0]
clean_username = re.sub("[^a-zA-Z0-9]", "_", username)
database = f"dbacademy_{clean_usern... | 24.375 | 116 | 0.67908 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
for stream in spark.streams.active:
stream.stop()
# COMMAND ----------
import pyspark.sql.functions as F
import re
dbutils.widgets.text("course", "dewd")
course_name = dbutils.widgets.get("course")
username = spark.sql("SELECT current_user()").first()[0]
clean_username = re.sub("[^a... | 29.814815 | 98 | 0.633267 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %scala
# MAGIC def cloudAndRegion = {
# MAGIC import com.databricks.backend.common.util.Project
# MAGIC import com.databricks.conf.trusted.ProjectConf
# MAGIC import com.databricks.backend.daemon.driver.DriverConf
# MAGIC val conf = new DriverConf(ProjectConf.loadLocalConfig... | 74.298507 | 188 | 0.650192 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
for stream in spark.streams.active:
stream.stop()
# COMMAND ----------
import pyspark.sql.functions as F
import re
course_name = "dewd"
username = spark.sql("SELECT current_user()").first()[0]
clean_username = re.sub("[^a-zA-Z0-9]", "_", username)
database = f"dbacademy_{clean_usern... | 27.876543 | 89 | 0.660393 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
class QueryGenerator:
def __init__(self, course, mode="normal"):
import re
import random
self.username = spark.sql("SELECT current_user()").first()[0]
self.userhome = f"dbfs:/user/{self.username}/{course}"
self.database = f"""dbacademy_{re.sub("[^... | 22.752809 | 107 | 0.612399 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./setup-updates
# COMMAND ----------
def merge_deduped_users():
spark.sql(f"""
CREATE OR REPLACE TEMP VIEW deduped_users AS
SELECT user_id, user_first_touch_timestamp, max(email) email, max(updated) updated
FROM users_update
GROUP BY user_id, user_first_touch_timest... | 21 | 84 | 0.657622 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
import sys, subprocess, os
subprocess.check_call([sys.executable, "-m", "pip", "install", "git+https://github.com/databricks-academy/user-setup"])
from dbacademy import LessonConfig
LessonConfig.configure(course_name="Databases Tables and Views on Databricks", use_db=False)
LessonConfig.in... | 37.888889 | 119 | 0.787966 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./setup
# COMMAND ----------
dbutils.fs.rm(f"{Paths.source}/sales/sales.csv", True)
dbutils.fs.cp(f"{Paths.source_uri}/sales/sales.csv", f"{Paths.source}/sales/sales.csv", True)
(spark
.read
.format("parquet")
.load(f"{Paths.source}/users/users.parquet")
.... | 22.545455 | 96 | 0.628627 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./setup
# COMMAND ----------
def load_historical():
spark.sql(f"""
CREATE OR REPLACE TABLE events AS
SELECT * FROM parquet.`{Paths.source}/events/events.parquet`
""")
spark.sql(f"""
CREATE OR REPLACE TABLE users AS
SELECT *, current_timestamp() updated FROM p... | 19.037037 | 89 | 0.65 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./sql-setup $course="meta" $mode="cleanup"
# COMMAND ----------
URI = "wasbs://courseware@dbacademy.blob.core.windows.net/databases_tables_and_views_on_databricks/v02"
# COMMAND ----------
dbutils.fs.cp(URI, f"{userhome}/datasets", True)
| 22.833333 | 103 | 0.677193 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./setup-cleaned
# COMMAND ----------
def create_transactions():
spark.sql(f"""
CREATE OR REPLACE TABLE transactions AS
SELECT * FROM (
SELECT
user_id,
order_id,
transaction_timestamp,
total_item_quantity,
purchase_reven... | 19.636364 | 64 | 0.506064 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %run ./setup-load
# COMMAND ----------
def load_events_raw():
spark.sql(f"""
CREATE TABLE IF NOT EXISTS events_json
(key BINARY, offset INT, partition BIGINT, timestamp BIGINT, topic STRING, value BINARY)
USING JSON OPTIONS (path = "{Paths.source}/events/events-kafka.json"... | 28.857143 | 504 | 0.693617 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
import pyspark.sql.functions as F
import re
class BuildEnvironmentVariables:
def __init__(self, username):
self.course_name = "eltsql"
self.source_uri = "wasbs://courseware@dbacademy.blob.core.windows.net/elt-with-spark-sql/v01"
self.username = username
... | 37.585859 | 122 | 0.665357 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
import pyspark.sql.functions as F
import re
dbutils.widgets.text("course", "dewd")
course = dbutils.widgets.get("course")
username = spark.sql("SELECT current_user()").collect()[0][0]
userhome = f"dbfs:/user/{username}/{course}"
database = f"""{course}_{re.sub("[^a-zA-Z0-9]", "_", username... | 28.060606 | 80 | 0.683716 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 40.695652 | 192 | 0.679541 |
data-engineering-with-databricks | https://github.com/Code360In/data-engineering-with-databricks | null | 6 | 1,141 | 2023-11-22 18:01:10+00:00 | 2022-01-28 23:53:31+00:00 | 1,349 | Creative Commons Zero v1.0 Universal | Python | # Databricks notebook source
# MAGIC %md
# MAGIC # Population Heatmap by State
# MAGIC Using *uszips.csv* as a data source, aggregate the populations by state.
# MAGIC Note: data file provided courtesy of SimpleMaps (https://simplemaps.com/data/us-zips)
# COMMAND ----------
# MAGIC %md
# MAGIC Source a Notebook to co... | 32.142857 | 186 | 0.686084 |
sfguide-data-engineering-with-snowpark-python | https://github.com/Snowflake-Labs/sfguide-data-engineering-with-snowpark-python | null | 53 | 2,339 | 2023-11-18 06:33:34+00:00 | 2023-01-23 16:06:45+00:00 | 513 | Apache License 2.0 | Python | import sys;
import os;
ignore_folders = ['__pycache__', '.ipynb_checkpoints']
if len(sys.argv) != 2:
print("Root directory is required")
exit()
root_directory = sys.argv[1]
print(f"Deploying all Snowpark apps in root directory {root_directory}")
# Walk the entire directory structure recursively
for (directo... | 33.232558 | 95 | 0.681849 |
sfguide-data-engineering-with-snowpark-python | https://github.com/Snowflake-Labs/sfguide-data-engineering-with-snowpark-python | null | 53 | 2,339 | 2023-11-18 06:33:34+00:00 | 2023-01-23 16:06:45+00:00 | 513 | Apache License 2.0 | Python | #------------------------------------------------------------------------------
# Hands-On Lab: Data Engineering with Snowpark
# Script: 02_load_raw.py
# Author: Jeremiah Hansen, Caleb Baechtold
# Last Updated: 1/9/2023
#------------------------------------------------------------------------------
import ... | 37.378049 | 110 | 0.617292 |
sfguide-data-engineering-with-snowpark-python | https://github.com/Snowflake-Labs/sfguide-data-engineering-with-snowpark-python | null | 53 | 2,339 | 2023-11-18 06:33:34+00:00 | 2023-01-23 16:06:45+00:00 | 513 | Apache License 2.0 | Python | #------------------------------------------------------------------------------
# Hands-On Lab: Data Engineering with Snowpark
# Script: 04_create_order_view.py
# Author: Jeremiah Hansen, Caleb Baechtold
# Last Updated: 1/9/2023
#------------------------------------------------------------------------------... | 51.894309 | 122 | 0.421983 |
sfguide-data-engineering-with-snowpark-python | https://github.com/Snowflake-Labs/sfguide-data-engineering-with-snowpark-python | null | 53 | 2,339 | 2023-11-18 06:33:34+00:00 | 2023-01-23 16:06:45+00:00 | 513 | Apache License 2.0 | Python | #------------------------------------------------------------------------------
# Hands-On Lab: Data Engineering with Snowpark
# Script: 07_daily_city_metrics_process_sp/app.py
# Author: Jeremiah Hansen, Caleb Baechtold
# Last Updated: 1/9/2023
#--------------------------------------------------------------... | 59.910569 | 214 | 0.578294 |
sfguide-data-engineering-with-snowpark-python | https://github.com/Snowflake-Labs/sfguide-data-engineering-with-snowpark-python | null | 53 | 2,339 | 2023-11-18 06:33:34+00:00 | 2023-01-23 16:06:45+00:00 | 513 | Apache License 2.0 | Python | from __future__ import annotations
import os
import configparser
from pathlib import Path
import toml
def get_dev_config(
environment: str = 'dev',
app_config_path: Path = Path.cwd().joinpath('app.toml'),
) -> dict:
try:
app_config = toml.load(app_config_path)
config = configparser.Config... | 31.457143 | 79 | 0.602643 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.