This file contains hidden or 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 zipfile | |
| from datetime import datetime | |
| from dagster import op, job | |
| from dagstd.constants import Constant, Five | |
| from dagstd.operations import fmt | |
| @op |
This file contains hidden or 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 sqlalchemy import ( | |
| Boolean, | |
| Column, | |
| ForeignKey, | |
| Integer, | |
| String, | |
| ) | |
| from sqlalchemy.orm import declarative_base | |
| Base = declarative_base() |
This file contains hidden or 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
| CREATE TABLE users ( | |
| id INTEGER NOT NULL, | |
| name VARCHAR(50), | |
| PRIMARY KEY (id) | |
| ); | |
| CREATE TABLE orders ( | |
| id INTEGER NOT NULL, | |
| user_id INTEGER, | |
| description VARCHAR(50), |
This file contains hidden or 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
| services: | |
| db: | |
| image: mysql | |
| environment: | |
| MYSQL_ROOT_PASSWORD: password | |
| MYSQL_DATABASE: default | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: password | |
| ports: | |
| - "3306:3306" |
This file contains hidden or 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 sqlalchemy.orm import Session | |
| ... | |
| class User(Base): | |
| ... | |
| class Order(Base): | |
| ... |
This file contains hidden or 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
| /* Naive Python implementation */ | |
| SELECT * | |
| FROM orders | |
| WHERE NOT payment_status | |
| -- Loop over the results from previous query | |
| -- and run this select each time | |
| SELECT * | |
| FROM users | |
| WHERE id = '{{ user_id }}' |
This file contains hidden or 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 timeit | |
| import faker | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| from cycler import cycler | |
| from sqlalchemy import ( | |
| Boolean, | |
| Column, | |
| ForeignKey, |
This file contains hidden or 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
| package main | |
| import ( | |
| "encoding/csv" | |
| "fmt" | |
| "log" | |
| "os" | |
| "path/filepath" | |
| "regexp" | |
| "sort" |
This file contains hidden or 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 sys | |
| from timeit import timeit | |
| RUNS = 100 | |
| def fibonacci(n: int) -> int: | |
| if n <= 1: | |
| return n | |
| return fibonacci(n - 1) + fibonacci(n - 2) |
This file contains hidden or 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
| use pyo3::prelude::*; | |
| /// Formats the sum of two numbers as string. | |
| #[pyfunction] | |
| fn sum_as_string(a: usize, b: usize) -> PyResult<String> { | |
| Ok((a + b).to_string()) | |
| } | |
| /// A Python module implemented in Rust. | |
| #[pymodule] |