update readme

This commit is contained in:
collerek
2020-11-01 13:18:43 +01:00
parent 21c3f6c500
commit 8e2a368203
2 changed files with 21 additions and 15 deletions

View File

@ -47,6 +47,7 @@ Ormar is built with:
* [`SQLAlchemy core`][sqlalchemy-core] for query building.
* [`databases`][databases] for cross-database async support.
* [`pydantic`][pydantic] for data validation.
* typing_extensions for python 3.6 - 3.7
### Migrations
@ -54,7 +55,7 @@ Because ormar is built on SQLAlchemy core, you can use [`alembic`][alembic] to p
database migrations.
**ormar is still under development:** We recommend pinning any dependencies with `ormar~=0.3.6`
**ormar is still under development:** We recommend pinning any dependencies with `ormar~=0.4.0`
### Quick Start
@ -74,9 +75,12 @@ class Album(ormar.Model):
tablename = "album"
metadata = metadata
database = database
id: int = ormar.Integer(primary_key=True)
name: str = ormar.String(length=100)
# note that type hints are optional so
# id = ormar.Integer(primary_key=True)
# is also valid
id = ormar.Integer(primary_key=True)
name = ormar.String(length=100)
class Track(ormar.Model):
@ -85,10 +89,10 @@ class Track(ormar.Model):
metadata = metadata
database = database
id: int = ormar.Integer(primary_key=True)
album= ormar.ForeignKey(Album)
title: str = ormar.String(length=100)
position: int = ormar.Integer()
id = ormar.Integer(primary_key=True)
album = ormar.ForeignKey(Album)
title = ormar.String(length=100)
position = ormar.Integer()
# Create some records to work with.
@ -196,6 +200,7 @@ The following keyword arguments are supported on all field types.
* `index: bool`
* `unique: bool`
* `choices: typing.Sequence`
* `name: str`
All fields are required unless one of the following is set:

View File

@ -47,6 +47,7 @@ Ormar is built with:
* [`SQLAlchemy core`][sqlalchemy-core] for query building.
* [`databases`][databases] for cross-database async support.
* [`pydantic`][pydantic] for data validation.
* typing_extensions for python 3.6 - 3.7
### Migrations
@ -54,7 +55,7 @@ Because ormar is built on SQLAlchemy core, you can use [`alembic`][alembic] to p
database migrations.
**ormar is still under development:** We recommend pinning any dependencies with `ormar~=0.3.6`
**ormar is still under development:** We recommend pinning any dependencies with `ormar~=0.4.0`
### Quick Start
@ -78,8 +79,8 @@ class Album(ormar.Model):
# note that type hints are optional so
# id = ormar.Integer(primary_key=True)
# is also valid
id: int = ormar.Integer(primary_key=True)
name: str = ormar.String(length=100)
id = ormar.Integer(primary_key=True)
name = ormar.String(length=100)
class Track(ormar.Model):
@ -88,10 +89,10 @@ class Track(ormar.Model):
metadata = metadata
database = database
id: int = ormar.Integer(primary_key=True)
album: Optional[Album] =ormar.ForeignKey(Album)
title: str = ormar.String(length=100)
position: int = ormar.Integer()
id = ormar.Integer(primary_key=True)
album = ormar.ForeignKey(Album)
title = ormar.String(length=100)
position = ormar.Integer()
# Create some records to work with.