Browse Source
📝 Update example source files for SQL databases with SQLAlchemy (#9508)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
pull/10915/head
Moustapha Sall
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
6 additions and
6 deletions
-
docs_src/sql_databases/sql_app/models.py
-
docs_src/sql_databases/sql_app_py310/models.py
-
docs_src/sql_databases/sql_app_py39/models.py
|
|
@ -7,7 +7,7 @@ from .database import Base |
|
|
|
class User(Base): |
|
|
|
__tablename__ = "users" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
email = Column(String, unique=True, index=True) |
|
|
|
hashed_password = Column(String) |
|
|
|
is_active = Column(Boolean, default=True) |
|
|
@ -18,7 +18,7 @@ class User(Base): |
|
|
|
class Item(Base): |
|
|
|
__tablename__ = "items" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
title = Column(String, index=True) |
|
|
|
description = Column(String, index=True) |
|
|
|
owner_id = Column(Integer, ForeignKey("users.id")) |
|
|
|
|
|
@ -7,7 +7,7 @@ from .database import Base |
|
|
|
class User(Base): |
|
|
|
__tablename__ = "users" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
email = Column(String, unique=True, index=True) |
|
|
|
hashed_password = Column(String) |
|
|
|
is_active = Column(Boolean, default=True) |
|
|
@ -18,7 +18,7 @@ class User(Base): |
|
|
|
class Item(Base): |
|
|
|
__tablename__ = "items" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
title = Column(String, index=True) |
|
|
|
description = Column(String, index=True) |
|
|
|
owner_id = Column(Integer, ForeignKey("users.id")) |
|
|
|
|
|
@ -7,7 +7,7 @@ from .database import Base |
|
|
|
class User(Base): |
|
|
|
__tablename__ = "users" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
email = Column(String, unique=True, index=True) |
|
|
|
hashed_password = Column(String) |
|
|
|
is_active = Column(Boolean, default=True) |
|
|
@ -18,7 +18,7 @@ class User(Base): |
|
|
|
class Item(Base): |
|
|
|
__tablename__ = "items" |
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True) |
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
title = Column(String, index=True) |
|
|
|
description = Column(String, index=True) |
|
|
|
owner_id = Column(Integer, ForeignKey("users.id")) |
|
|
|