Posts

Showing posts with the label libraries

Introduction Migrations

Image
 Introduction Migrations What are migrations? - A migration is a file that keeps track of changes to our database schema (structure of our database). - Offers version control on our schema. - Migrations deal with how we manage modifications to our data schema, over time. Benefits of migrations in our app: - Mistakes to our database schema are very expensive to make.  - The entire app can go down, so we want to quickly roll back changes, and test changes before we make them. - Encapsulate a set of changes to our database schema, made over time. - Are uniquely named. - Are usually stored as local files in our project repo, e.g. a migrations/ folder. - There should be a one-to-one mapping between the changes made to our database, and the migration files that exist in our migrations/ folder. - Our migrations files set up the tables for our database. - All changes made to our db should exist physically as part of migration files in our repository. Upgrades and rollbacks: - Migratio...

SQLAlchemy library for python

Image
 SQLAlchemy library for python  Introduction: What is SQLAlchemy? SQLAlchemy is a popular SQL toolkit and Object Relational Mapper.  It is written in Python and gives full power and flexibility of SQL to an application developer.  It is open-source and cross-platform software released under MIT license.  SQLAlchemy is famous for its object-relational mapper (ORM), using which classes can be mapped to the database, thereby allowing the object model and database schema to develop in a cleanly decoupled way from the beginning. It is one type of ORM library, AKA an Object-Relational Mapping library, which provides an interface for using object-oriented programming to interact with a database. Other ORM libraries that exist across other languages include popular choices like javascript libraries Sequelize and Bookshelf. js for NodeJS applications, the ruby library ActiveRecord, which is used inside Ruby on Rails, and CakePHP for applications written on PHP, amongst m...