Skip to content

FernandoCelmer/project-basic-test-sqlalchemy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[project-basic-test-sqlalchemy]

GitHub followers GitHub last commit

✔️ About

This repository contains a basic Python project for performing database operations using the SQLAlchemy ORM.

🚀 Stack

Instructions

Installing Local Project with [PIP]
  • Create a new Python virtual environment
virtualenv -p python3.9 venv
  • Activate the virtual environment
source venv/bin/activate
  • Install requirements with PIP
pip install -r requirements.txt

Running

Option Command
SQLAlchemy ORM python setup.py run_sql_orm --value 1 --thread 10
SQLAlchemy ORM add_all() python setup.py run_sql_orm_add_all --value 1 --thread 10
SQLAlchemy ORM bulk_save_objects() python setup.py run_sql_orm_bulk_insert --value 1 --thread 10
SQLAlchemy Core python setup.py run_sql_core --value 1 --thread 10

Test - SQLite

  • SQLAlchemy ORM: Total 5.3358 seconds
  • SQLAlchemy ORM add_all(): Total 4.8070 seconds
  • SQLAlchemy ORM bulk_save_objects(): Total 0.7364 seconds
  • SQLAlchemy Core: Total 0.5063 seconds

Test - MySQL

  • SQLAlchemy ORM: --
  • SQLAlchemy ORM add_all(): --
  • SQLAlchemy ORM bulk_save_objects(): Total 5.8701 seconds
  • SQLAlchemy Core: Total 11.2585 seconds

Test - Mysql (1000:Inserts) * (10:Threads)

SQLAlchemy ORM
SQLAlchemy ORM add_all()
SQLAlchemy ORM bulk_save_objects()
running run_sql_orm_bulk_insert
SQLAlchemy ORM bulk_save_objects(): Total [0:00:00.853800]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.749000]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.771200]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.773400]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.776300]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.945100]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.912700]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:01.929000]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:02.022500]
SQLAlchemy ORM bulk_save_objects(): Total [0:00:02.732800]
SQLAlchemy Core
running run_sql_core
SQLAlchemy Core: Total [0:00:00.791400]
SQLAlchemy Core: Total [0:00:01.689200]
SQLAlchemy Core: Total [0:00:01.733400]
SQLAlchemy Core: Total [0:00:01.730500]
SQLAlchemy Core: Total [0:00:01.688000]
SQLAlchemy Core: Total [0:00:01.728900]
SQLAlchemy Core: Total [0:00:01.718400]
SQLAlchemy Core: Total [0:00:01.691300]
SQLAlchemy Core: Total [0:00:01.713200]
SQLAlchemy Core: Total [0:00:01.835200]