Relative Content

Tag Archive for pythonflasksqlalchemyflask-sqlalchemy

building a database using SQLAchemy

Hello I kind of stuck in making a database for my flask application using SQLAlchemy. infact I’m watching a toturial for flask apps, everything was ok until I’ve reached this error: SQLAlchemy.create_all() got an unexpected argument ‘app’

building a database using SQLAchemy

Hello I kind of stuck in making a database for my flask application using SQLAlchemy. infact I’m watching a toturial for flask apps, everything was ok until I’ve reached this error: SQLAlchemy.create_all() got an unexpected argument ‘app’

SQLAlchemy-Utils Aggregated Attributes: How to apply filter before aggregating to create an aggregated field?

from sqlalchemy_utils import aggregated class Thread(Base): __tablename__ = ‘thread’ id = sa.Column(sa.Integer, primary_key=True) name = sa.Column(sa.Unicode(255)) @aggregated(‘comments’, sa.Column(sa.Integer)) def comment_count(self): return sa.func.count(‘1’) comments = sa.orm.relationship( ‘Comment’, backref=’thread’ ) class Comment(Base): __tablename__ = ‘comment’ id = sa.Column(sa.Integer, primary_key=True) content = sa.Column(sa.UnicodeText) thread_id = sa.Column(sa.Integer, sa.ForeignKey(Thread.id)) active = sa.Column(sa.Boolean) I want the comment_count field to be count […]

Databases don’t save the information’s

I’ve been working on a Flask application for a college project, and I’m facing an issue where the data isn’t getting saved to the database. Everything seems to work fine, but for some reason, the data isn’t persisting.

Flask-SQLAlchemy. How create tables in second base

I’m struggling to create tables in the second database. I’ve tried many options, but the tables just won’t create. If I use the main database (without specifying binds), everything creates and works fine, but in the second database, using db.Table, no tables are created (tables created through classes work without any issues)