This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM rental; | |
/* | |
|id |customer_id|store_id|amount|status |notes|rental_date |return_date | | |
|---|-----------|--------|------|------------|-----|----------------------|----------------------| | |
| 1 | 100 | 4 | 12.49| "completed"| | "2021-05-01 12:45:39"| "2021-05-03 15:10:02"| | |
| 3 | 100 | 4 | 5.68 | "on_rental"| | "2022-10-01 12:45:39"| | | |
| 2 | 58 | 2 | 9.32 | "on_rental"| | "2022-09-01 08:21:32"| | | |
| 4 | 100 | 4 | 1.67 | "completed"| | "2022-09-01 08:21:32"| "2022-09-02 09:21:22"| | |
| 5 | 100 | 6 | 2.67 | "completed"| | "2022-05-01 08:21:32"| "2022-05-02 09:21:22"| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO rental VALUES (1, 100, 4, 12.49, 'completed', NULL, '2021-05-01 12:45:39'::timestamp, '2021-05-03 15:10:02'::timestamp) | |
INSERT INTO rental VALUES (3, 100, 4, 5.68, 'on_rental', NULL, '2022-10-01 12:45:39'::timestamp, NULL) | |
INSERT INTO rental VALUES (3, 100, 4, 5.68, 'on_rental', NULL, '2022-10-01 12:45:39'::timestamp, NULL) | |
INSERT INTO rental VALUES (4, 100, 4, 1.67, 'completed', NULL, '2022-09-01 08:21:32'::timestamp, '2022-09-02 09:21:22'::timestamp) | |
INSERT INTO rental VALUES (5, 100, 6, 2.67, 'completed', NULL, '2022-05-01 08:21:32'::timestamp, '2022-05-02 09:21:22'::timestamp) | |
INSERT INTO rental VALUES (6, 100, 6, 0.49, 'completed', NULL, '2022-05-03 08:21:32'::timestamp, '2022-05-04 09:21:22'::timestamp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS rental; | |
CREATE TABLE rental ( | |
id INTEGER PRIMARY KEY, | |
customer_id INTEGER NOT NULL, | |
store_id INTEGER NOT NULL, | |
amount FLOAT NOT NULL, | |
status VARCHAR(255) NOT NULL, | |
notes VARCHAR(255), | |
rental_date TIMESTAMP, | |
return_date TIMESTAMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
print('Hello World!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import timedelta | |
from airflow.models import DAG | |
from airflow.utils.dates import days_ago | |
from airflow.providers.google.cloud.operators.gcs import GCSDeleteObjectsOperator | |
from airflow.providers.google.cloud.transfers.gcs_to_bigquery import GCSToBigQueryOperator | |
from airflow.providers.google.cloud.transfers.postgres_to_gcs import PostgresToGCSOperator | |
BQ_DS = 'my_dataset' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student: | |
def __init__(self, first_name, last_name): | |
self.first_name = first_name | |
self.last_name = last_name | |
def __str__(self): | |
return f'Student Name: {self.first_name} {self.last_name}' | |
class Lecturer: | |
def __init__(self, first_name, last_name, subject): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
x = [1, 10] | |
y = [3, 6] | |
ax = plt.subplot(111) | |
ax.plot(x, y, '--') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import requests | |
from time import sleep | |
API_KEY = <your AssemblyAI API key goes here> | |
AUDIO_FILE = '/path/to/your/audio/file.mp3' | |
UPLOAD_ENDPOINT = 'https://api.assemblyai.com/v2/upload' | |
TRANSCRIPT_ENDPOINT = 'https://api.assemblyai.com/v2/transcript' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"id": "audio-transcription-id", | |
"status": "completed", | |
"text": "Ted Talks are recorded live at Ted Conference..." | |
"iab_categories_result": { | |
"status": "success", | |
"results": [ | |
{ | |
"text": "Ted Talks are recorded live at Ted Conference...", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OUTPUT_TRANSCRIPT_FILE = 'speech-to-text-tutorial.txt' | |
with open(OUTPUT_TRANSCRIPT_FILE, 'w') as f: | |
f.write(res_result.json()['text']) | |
print(f'Transcript file saved under {OUTPUT_TRANSCRIPT_FILE}') |