{"id":22357231,"url":"https://github.com/mdh266/sqlwars","last_synced_at":"2026-04-11T05:35:27.198Z","repository":{"id":93022927,"uuid":"87228712","full_name":"mdh266/SQLWars","owner":"mdh266","description":"Comparing Relational Databases","archived":false,"fork":false,"pushed_at":"2017-07-16T02:36:36.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T13:22:22.230Z","etag":null,"topics":["postgresql","psycopg2","python","sql","sqlalchemy","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"http://michael-harmon.com/blog/SQLWars.html","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdh266.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-04-04T19:51:24.000Z","updated_at":"2017-04-28T13:53:01.000Z","dependencies_parsed_at":"2023-03-06T06:15:38.206Z","dependency_job_id":null,"html_url":"https://github.com/mdh266/SQLWars","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"4873cbec5fcb9b047f72c87f907917329042fdda"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdh266/SQLWars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FSQLWars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FSQLWars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FSQLWars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FSQLWars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdh266","download_url":"https://codeload.github.com/mdh266/SQLWars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FSQLWars/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265481935,"owners_count":23773976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","psycopg2","python","sql","sqlalchemy","sqlite","sqlite3"],"created_at":"2024-12-04T14:13:37.897Z","updated_at":"2025-12-30T21:33:35.636Z","avatar_url":"https://github.com/mdh266.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Wars: Comparing Relational Databases\n\n## Introduction\nComing from a computational science/applied mathematics background many of the ideas of data science/machine learning are second nature to me. One thing that was very new to me was creating and manipulating databases. In computational science we don't really deal with databases and I/O is something to avoid as much as possible because it limits performance. Therefore, in this blog post I'll be going what I have learend about SQL databases, i.e. what they are, how to set them up, and how to use them.\n\n### SQL And What I'll Cover:\nSQL stands for Structured Query Language. It is a domain specific language used in programming to deal with data that is stored in a relational database. SQL is designed for a specific purpose: to query data contained in a relational database. There are plently of good references on how to learn SQL query commands, two that I used are,\n\n1. \u003ca href=\"http://sqlzoo.net/\"\u003eSQLZOO\u003c/a\u003e\n2. \u003ca href=\"https://www.w3schools.com/sql/\"\u003ew3schools.com\u003c/a\u003e\n\nHowever, this is not what I intend to cover here.  Instead, I would like to look at how one can create and interact with different implementations of SQL databases.  And specifically how to do this using Python.  There are many different implementations of SQL: SQLite, Oracle, MySQL, PostgreSQL, etc.  The basic operations on SQL databases that are common to all the implementations are described in the acronym, C.R.U.D.:\n\n- **C**reate: How to create a database and tables.\n- **R**ead: How read from a table in a database.\n- **U**pdate: How to update the values in a table in the database.\n- **D**elete: How to delete rows from a table in the database.\n\n\nFor now the SQL implementations I'll be focusing on are,\n\n* \u003ca href=\"https://www.sqlite.org/\"\u003eSQLite\u003c/a\u003e and Python's interface to it \u003ca href=\"https://docs.python.org/2/library/sqlite3.html\"\u003esqlite3\u003c/a\u003e.\n\nand \n\n* \u003ca href=\"https://www.postgresql.org/\"\u003ePostgreSQL\u003c/a\u003e and Python's interface to it \u003ca href=\"https://www.sqlalchemy.org/\"\u003esqlalchemy\u003c/a\u003e and \u003ca href=\"http://initd.org/psycopg/\"\u003epsycopg2\u003c/a\u003e.\n\nAs we'll see most of the differences between working with the two implementations will be in how we create the databases.  The queries will be relatively the same, but the libaries we use to interact with the databases will be different depending on the SQL implementation. I'll be updating this blog post as a time goes on, so check back later for new additions.\n\n## Requirements\n1. \u003ca href=\"https://www.python.org/\"\u003e Python\u003c/a\u003e 2.7\n2. \u003ca href=\"http://jupyter.org/\"\u003eJupyter Notebook\u003c/a\u003e\n3. \u003ca href=\"https://www.sqlalchemy.org/\"\u003eSQLAlchemy\u003c/a\u003e\n4. \u003ca href=\"https://sqlalchemy-utils.readthedocs.io/en/latest/\"\u003eSQLAlchemy-Utils\u003c/a\u003e\n5. \u003ca href=\"http://initd.org/psycopg/\"\u003epsycopg2\u003c/a\u003e\n\nTo install the requirements with pip (except for Python), type in the main directory:\n\n\u003ccode\u003e pip install -r requirements.txt \u003c/code\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdh266%2Fsqlwars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdh266%2Fsqlwars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdh266%2Fsqlwars/lists"}