No description
Find a file
2023-05-19 08:35:16 -05:00
learn_sql_model init 2023-05-19 08:35:16 -05:00
migrations init 2023-05-19 08:35:16 -05:00
templates init 2023-05-19 08:35:16 -05:00
tests init 2023-05-19 08:35:16 -05:00
.gitignore init 2023-05-19 08:35:16 -05:00
.learn-sql-model-copier-answers.yml init 2023-05-19 08:35:16 -05:00
alembic.ini init 2023-05-19 08:35:16 -05:00
CHANGELOG.md init 2023-05-19 08:35:16 -05:00
database.db init 2023-05-19 08:35:16 -05:00
LICENSE.txt init 2023-05-19 08:35:16 -05:00
pyproject.toml init 2023-05-19 08:35:16 -05:00
README.md init 2023-05-19 08:35:16 -05:00

Learn SQL Model

learning sql model

Development

pip install hatch
hatch shell

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 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'

License

learn-sql-model is distributed under the terms of the MIT license.