Socket
Book a DemoInstallSign in
Socket

sql-compare

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-compare

Compare SQL schemas

pipPyPI
Version
0.1.9
Maintainers
1

SQL Compare

Compare SQL schemas.

This package allows to compare two SQL files (or strings) to know whether their statements are the same or not. The comparison doesn't care about the order of the columns in a table or the order of the values in an enumerator. It also excludes irrelevant data like comments.

Its main usage is to compare the schemas of two databases (e.g. staging and production). See this blog post that tells about the creation of the package.

Installation

$ pip install sql-compare

Usage

Compare two SQL schemas using strings.

import sql_compare

assert sql_compare.compare(first_schema, second_schema)

Compare two SQL schemas using files.

import pathlib
import sql_compare

first_schema = pathlib.Path("/path/to/schema.sql")
second_schema = pathlib.Path("/path/to/other/schema.sql")

assert sql_compare.compare_files(first_schema, second_schema)

Dependencies

SQL Compare relies on sqlparse to parse SQL statements.

Keywords

sql

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts