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. * [`SQLAlchemy core`][sqlalchemy-core] for query building.
* [`databases`][databases] for cross-database async support. * [`databases`][databases] for cross-database async support.
* [`pydantic`][pydantic] for data validation. * [`pydantic`][pydantic] for data validation.
* typing_extensions for python 3.6 - 3.7
### Migrations ### Migrations
@ -54,7 +55,7 @@ Because ormar is built on SQLAlchemy core, you can use [`alembic`][alembic] to p
database migrations. 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 ### Quick Start
@ -75,8 +76,11 @@ class Album(ormar.Model):
metadata = metadata metadata = metadata
database = database database = database
id: int = ormar.Integer(primary_key=True) # note that type hints are optional so
name: str = ormar.String(length=100) # id = ormar.Integer(primary_key=True)
# is also valid
id = ormar.Integer(primary_key=True)
name = ormar.String(length=100)
class Track(ormar.Model): class Track(ormar.Model):
@ -85,10 +89,10 @@ class Track(ormar.Model):
metadata = metadata metadata = metadata
database = database database = database
id: int = ormar.Integer(primary_key=True) id = ormar.Integer(primary_key=True)
album = ormar.ForeignKey(Album) album = ormar.ForeignKey(Album)
title: str = ormar.String(length=100) title = ormar.String(length=100)
position: int = ormar.Integer() position = ormar.Integer()
# Create some records to work with. # Create some records to work with.
@ -196,6 +200,7 @@ The following keyword arguments are supported on all field types.
* `index: bool` * `index: bool`
* `unique: bool` * `unique: bool`
* `choices: typing.Sequence` * `choices: typing.Sequence`
* `name: str`
All fields are required unless one of the following is set: 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. * [`SQLAlchemy core`][sqlalchemy-core] for query building.
* [`databases`][databases] for cross-database async support. * [`databases`][databases] for cross-database async support.
* [`pydantic`][pydantic] for data validation. * [`pydantic`][pydantic] for data validation.
* typing_extensions for python 3.6 - 3.7
### Migrations ### Migrations
@ -54,7 +55,7 @@ Because ormar is built on SQLAlchemy core, you can use [`alembic`][alembic] to p
database migrations. 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 ### Quick Start
@ -78,8 +79,8 @@ class Album(ormar.Model):
# note that type hints are optional so # note that type hints are optional so
# id = ormar.Integer(primary_key=True) # id = ormar.Integer(primary_key=True)
# is also valid # is also valid
id: int = ormar.Integer(primary_key=True) id = ormar.Integer(primary_key=True)
name: str = ormar.String(length=100) name = ormar.String(length=100)
class Track(ormar.Model): class Track(ormar.Model):
@ -88,10 +89,10 @@ class Track(ormar.Model):
metadata = metadata metadata = metadata
database = database database = database
id: int = ormar.Integer(primary_key=True) id = ormar.Integer(primary_key=True)
album: Optional[Album] =ormar.ForeignKey(Album) album = ormar.ForeignKey(Album)
title: str = ormar.String(length=100) title = ormar.String(length=100)
position: int = ormar.Integer() position = ormar.Integer()
# Create some records to work with. # Create some records to work with.