renames etc.
This commit is contained in:
@ -1,16 +1,16 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
# if you omit this parameter it will be created automatically
|
||||
# as class.__name__.lower()+'s' -> "courses" in this example
|
||||
__tablename__ = "my_courses"
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
print(Course.__pydantic_model__.__fields__)
|
||||
"""
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
print(Course.__table__.columns)
|
||||
"""
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
print(Course.__model_fields__)
|
||||
"""
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Department(orm.Model):
|
||||
class Department(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
department = orm.ForeignKey(Department)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
department = ormar.ForeignKey(Department)
|
||||
|
||||
|
||||
department = Department(name="Science")
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import orm
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(orm.Model):
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = orm.Integer(primary_key=True)
|
||||
name = orm.String(length=100)
|
||||
completed = orm.Boolean(default=False)
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
|
||||
course = Course(name="Painting for dummies", completed=False)
|
||||
|
||||
Reference in New Issue
Block a user