A simple Flask "CLI" application that serializes data from the database
Install depencies
pip installThe application comes with several flask CLI helper commands to help setup the project for the demo.
flask migrate: Creates adb.sqlitedatabase file and creates astudenttable.flask seed-students <COUNT>: Seeds student records.flask refresh: Drops all tables and creates the schema again.flask export-students: Exports student records tostudent.xmlfile.flask deserialize: Deserialize data instudent.xmlfile into Student objects.
- Install dependencies
- Copy
.env.exampleto.env - Migrate schema
flask migrate
- Seed 10 student records
flask seed-students 10
- Export xml data
flask export-students
<?xml version="1.0" ?>
<students>
<student>
<id>1</id>
<student_number>26</student_number>
<first_name>Mariah</first_name>
<last_name>Kelly</last_name>
<email>richardtrujillo@yahoo.com</email>
</student>
<student>
<id>2</id>
<student_number>94</student_number>
<first_name>Donna</first_name>
<last_name>Nash</last_name>
<email>alexandriaswanson@gonzalez.com</email>
</student>
<student>
<id>3</id>
<student_number>58</student_number>
<first_name>Brittany</first_name>
<last_name>Ramirez</last_name>
<email>bthompson@johnson-morgan.com</email>
</student>
</students>