Modelagem.

parent 30ebceda
...@@ -3,8 +3,12 @@ from flask_sqlalchemy import SQLAlchemy ...@@ -3,8 +3,12 @@ from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() db = SQLAlchemy()
class Animal(db.Model): class Animal(db.Model):
id = db.Column(db.Integer, primary_key=True) __tablename__ = 'animais'
nome = db.Column(db.String(50), nullable=False) id = db.Column(db.Integer, primary_key=True)
especie = db.Column(db.String(50), nullable=False) nome = db.Column(db.String(100), nullable=False)
idade = db.Column(db.Integer) especie = db.Column(db.String(50), nullable=False)
peso = db.Column(db.Float) idade = db.Column(db.Integer, nullable=False)
\ No newline at end of file peso = db.Column(db.Float, nullable=False)
def __repr__(self):
return f'<Animal {self.nome}>'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment