No description
| .github/workflows | ||
| bin | ||
| learn_sql_model | ||
| lights | ||
| migrations | ||
| templates | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| .learn-sql-model-copier-answers.yml | ||
| .pyflyby | ||
| alembic.ini | ||
| CHANGELOG.md | ||
| client.py | ||
| client_sender.py | ||
| creeper.png | ||
| d3.py | ||
| database.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| dockerfile-dev | ||
| Dockerfile.dev | ||
| er_diagram.png | ||
| fly.toml | ||
| im.png | ||
| index.html | ||
| LICENSE.txt | ||
| load_test.py | ||
| locustfile.py | ||
| map.pkl | ||
| map.png | ||
| markata.toml | ||
| micro | ||
| notify.py | ||
| pet.png | ||
| player.png | ||
| pyproject.toml | ||
| README.md | ||
| rect.py | ||
| tmp.py | ||
| tmp.sh | ||
| wyatt.py | ||
Learn SQL Model
learning sql model
Development
pip install hatch
hatch shell
Development with Docker
docker compose build
docker compose up -d
To attach to the cli.
docker attach learn-sql-model-cli-1
Start the Server
learn-sql-model api run
Use the cli to manage Heros
learn-sql-model hero create
# show them
learn-sql-model hero get
# show one
learn-sql-model hero get --id 0
Use python to manage Heros
from learn_sql_model.models.hero import Hero
# create a hero
bruce = Hero(name="Batman", secret_name="Bruce Wayne")
bruce.post()
# list all heros
Hero.get()
# get one hero
Hero.get(0)
Use api to create hero
# create a curl POST request to create hero
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name": "Batman", "secret_name": "Bruce Wayne"}' \
http://localhost:5000/heros
# list all heros
curl http://localhost:5000/heros
curl -X 'GET' \
'http://localhost:5000/heros/' \
-H 'accept: application/json'
# get one hero
curl -X 'GET' \
'http://localhost:5000/hero/9' \
-H 'accept: application/json'
Settings Management
config support .env, .env.dev, .env.qa, .env.prod.
ENV=dev
DATABASE_URL=sqlite:///db.sqlite
API_SERVER__PORT=8000
API_SERVER__RELOAD=False
API_SERVER__LOG_LEVEL=debug
Populating the database
learn-sql-model hero populate
Creating new modesl
learn-sql-model model create
License
learn-sql-model is distributed under the terms of the MIT license.