diff --git a/README.md b/README.md index c2b0daa..6ce8908 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/docs/index.md b/docs/index.md index 0b691dd..6ce8908 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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.