from fastapi import FastAPI app = FastAPI() @app.get("/") def root(): return {"message": "Hello World"} Info As FastAPI supports ASGI (Asyschronous Server Gateway Interface), the function root can also be an async function. Use async optionally with await when the function does not need to wait for steps in the function to be completed. Run the live server: uvicorn main:app --reload
main: the file main.py (the Python “module”). app: the object created inside of main.
CLI Command Structure:
aws <command> <subcommand> [options and parameters]
aws <command> wait <subcommand> [options and parameters] (supported by some commands)
Info Save output to a file using the > command. For example: aws dynamodb scan --table-name MusicCollection > output.json.
Tip: Use >> to append to a file. Also useful - Load Parameters from a file
Set Up Using long-term credentials with IAM user (Not recommended):
aws configure Using short-term credentialswith IAM user:
Single line comment: -- comment
Multiline comment: /* comments */
Data query Language (DQL) SELECT 'ID: ', id, col_1 + col_2, sqrt(col_2) FROM t1 -- precedence within WHERE: functions, comparisons, NOT, AND, OR WHERE col_1 > 100 AND NOT MOD(col_2, 10) = 0 OR col_3 < col_1 ORDER BY col_4 DESC, col_5; -- number of rows, number of not-null-values SELECT COUNT(*), COUNT(col_1) FROM t1; -- predefined functions SELECT COUNT(col_1), MAX(col_1), MIN(col_1), AVG(col_1), SUM(col_1) FROM t1; -- UNIQUE values only SELECT DISTINCT col_1 FROM t1; -- Only the combination of col_1 plus col_2 is unique SELECT DISTINCT col_1, col_2 FROM t1; Case Expression SELECT id, CASE contact_type WHEN 'fixed line' THEN 'Phone' WHEN 'mobile' THEN 'Phone' ELSE 'Not a telephone number' END AS 'contact_type', contact_value FROM contact; There are two short forms for special CASE expressions: COALESCE and NULLIF.
View full page demo
Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that can be customized to solve a recurring design problem in any code.
All patterns can be categorized by their intent, or purpose.
Creational Patterns This pattern provides ways to create object creation in a manner that increases flexibility and reuse of code.
Factory Method This pattern provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.