Skip to content

A simple ORM (Object relational mapping) to migrate data models into an Sqlite3 database

Notifications You must be signed in to change notification settings

BenAyedSeeksAI/Mini-ORM-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini-ORM-Python

A simple ORM to migrate data models into an Sqlite3 database, I used sqlite3 python library. Please, check this hackernoon article to explain more the project in detail

Notice

This project is still under development. So further changes will come up Insha2allah.

Usage

All you need to do is to define a base model class in the base.py file. of course you need to specify the table name of the model and its fields. the class inherits from baseModel.

class Model(baseModel):
    base_model = base
    tablename = "Model"
    fields = ("field_1", "field_2")

In the same file you need to add the model into your the python list model_list:

model_list = [Model,
              ]

To make a migration you need to execute this following command:

python migrate_manager.py migrate

The following output in the command prompt will show up to confirm the successful migration:

Begin database Migration ...

Model Migration
Connection started ...
Model: created successfully!
2022-01-04 02:29:53.402991: Commit is successful!!
Connection ended ...

About

A simple ORM (Object relational mapping) to migrate data models into an Sqlite3 database

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages