Demo: database extension only
Check the following link to review this basic demo.
This demo provides the following features:
- A very simple database composed of two tables:
new_model
andnumerical_model
. - The relationship between
new_model
andnumerical_model
is one-to-many. - Each
numerical_model
contains a float-point value. - The demo will query the
new_model
with different conditions applied to thenumerical_model
of eachnew_model
item.
The entity-relationship diagram (ERD) of the database is:
The query results should be like this:
16:41:05,028 flask-sqlalchemy-compat.example INFO Start to add testing data.
16:41:05,036 flask-sqlalchemy-compat.example INFO Start to query data.
16:41:05,036 flask-sqlalchemy-compat.example INFO Query by name.
16:41:05,041 flask-sqlalchemy-compat.example INFO Queried: NewModel(id=3, name=mixed, n_vals=3)
16:41:05,041 flask-sqlalchemy-compat.example INFO Query all models having positive values.
16:41:05,043 flask-sqlalchemy-compat.example INFO Queried: [NewModel(id=1, name=only-pos, n_vals=3), NewModel(id=3, name=mixed, n_vals=3)]
16:41:05,043 flask-sqlalchemy-compat.example INFO Query all models having negative values.
16:41:05,045 flask-sqlalchemy-compat.example INFO Queried: [NewModel(id=2, name=only-neg, n_vals=3), NewModel(id=3, name=mixed, n_vals=3)]
16:41:05,045 flask-sqlalchemy-compat.example INFO Query all models having both positive and negative values.
16:41:05,047 flask-sqlalchemy-compat.example INFO Queried: [NewModel(id=3, name=mixed, n_vals=3)]