Note that there are some explanatory texts on larger screens.

plurals
  1. POFlask, SQLAlchemy, Foreign Keys
    primarykey
    data
    text
    <p>Hello I have some Problem with some foreign keys.</p> <p>I have something like this: </p> <pre><code>class Foo(db.Model): """The foo object.""" __tablename__ = 'foos_foo' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.Text, unique=True) content = db.Column(db.Text) bar = db.relationship('Bar', backref='bars_bar') bar_id = db.Column(db.Integer, db.ForeignKey('bars_bar.id')) class Bar(db.Model): """The bar object.""" __tablename__ = 'bars_bar' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text, unique=True) description = db.Column(db.Text) status = db.Column(db.SmallInteger, default=NEW) </code></pre> <p>I use this configuration style: <a href="https://github.com/mitsuhiko/flask/wiki/Large-app-how-to" rel="nofollow">https://github.com/mitsuhiko/flask/wiki/Large-app-how-to</a></p> <p>So I have something like this:</p> <pre><code>from app.foos.views import mod as foosModule from app.bars.views import mod as barsModule app.register_blueprint(foosModule) app.register_blueprint(barsModule) </code></pre> <p>If I call like in the config style from Mitsuhiko, python shell.py, comes this error:</p> <pre><code>sqlalchemy.exc.OperationalError: (OperationalError) no such table: bars_bar u'SELECT bars_bar.id AS bars_bar_id, bars_bar.name AS bars_bar_name, bars_bar.description AS bars_bar_description, bars_bar.status AS bars_bar_status \nFROM bars_bar' () </code></pre> <p>What goes on there? Yes the table is not there because I will create it? Is there a way to create some tables before some other? Or what do I wrong?</p> <p>Thanks for your time!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload