Hold the Vision, Trust the Process.
... basic example for SQLAlchemy Object Relational Mapper to associate user-defined Python classes with database tables.
ORMs provide a high-level abstraction upon a relational database that allows a developer to write Python code instead of SQL to create, read, update and delete data and schemas in their database.
# Oracle SQL
SELECT * FROM USERS WHERE dept_code='DEVOPS';
# Obtain everyone in the department code DEVOPS and assign to users variable.
users = Users.objects.filter(zip_code=94107)
There are numerous ORM implementations written in Python, which includes:
- SQLAlchemy
- Peewee
- The Django ORM
- PonyORM
- SQLObject
(Similarly, we have Hibernate, Eclipselink, Enterprise JavaBeans Entity Beans, Castor in java.)
pip install sqlalchemy
import sqlalchemy
sqlalchemy.__version__
1.2.7
pip install flask
🚧 Run seed.sql for table creation in Database:
sqlite3 test_users.db < seed.sql
#test_users.db will be created in your directory!
sqlite3 test_users.db
SQLite version 3.23.1 2018-04-10 17:39:29
Enter ".help" for usage hints.
sqlite>
🚧 Get hands on: Kick-off
python -m DIRECTORY.Main.py
- sqlalchemy
- flask
- sqlite3
- Ubuntu 16.4 LTS
📧 Drop In!! Seriously, it'd be great to discuss Technology.