A lightweight, transparent wrapper around SQLAlchemy (both 1.x and 2.x)
designed for interactive database exploration, debugging, testing, and
REPL-driven development workflows. Rather than building yet another ORM
or complex abstraction layer, sql-helper trusts you to understand SQL
and provides transparent, immediate access to databases with minimal
mental overhead.
It integrates seamlessly with IPython, supports automatic Docker
database provisioning, and works across SQLite, MySQL, PostgreSQL, and
Redshift with consistent APIs that adapt to database-specific behaviors.
The library also provides adaptive result formatting based on the query
structure. Single values for aggregations, simple lists for single
columns, and lists of dictionaries for multiple columns.
Tested for Python 3.6 - 3.13 using both SQLAlchemy 1.x and 2.x against
PostgreSQL 13 and MySQL 8.0 docker containers.
Connect with a DB url in the following formats:
- ``postgresql://someuser:somepassword@somehost[:someport]/somedatabase``
- ``mysql://someuser:somepassword@somehost[:someport]/somedatabase``
- *note: urls that start with ``mysql://`` will automatically be
changed to use ``mysql+pymysql://`` since this packages uses the
``pymysql`` driver*
- ``sqlite:///somedb.db``
- ``redshift+psycopg2://someuser:somepassword@somehost/somedatabase``
- *note: requires separate install of the ``sqlalchemy-redshift``
package*
Install
-------
First, ensure that the ``pg_config`` executable is on the system and
that the ``cryptography`` dependency can either be built with Rust or
the pre-compiled wheel can be used. (*See “Dependencies” section below*)
Then install with ``pip``:
::
pip install sql-helper
Dependencies
~~~~~~~~~~~~
pg_config for postgresql
^^^^^^^^^^^^^^^^^^^^^^^^
::
sudo apt-get install -y libpq-dev
or
::
brew install postgresql
cryptography package
^^^^^^^^^^^^^^^^^^^^
If using Python 3.6, be sure to update pip to **at least version
20.3.4** (default pip is 18.1) so that the pre-compiled wheel for
``cryptography`` can be used. Otherwise, you will need to install the
`rust compiler <https://www.rust-lang.org>`__ so that the
``cryptography`` dependency can be built
(``curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y``)
If using Python 3.5, there is no pre-compiled wheel for ``cryptography``
(even when upgrading pip to version 20.3.4). It also cannot be built if
the rust compiler is installed. Support for Python 3.5 is effectively
removed.
pymysql package
^^^^^^^^^^^^^^^
According to https://nvd.nist.gov/vuln/detail/CVE-2024-36039, pymysql
versions below 1.1.1 are vulnerable to SQL injection. Version 1.1.1 is
only available for Python 3.7+ (final version for Python 3.6 is 1.0.2;
final working version for Python 3.5 is 0.9.3).
sqlalchemy-redshift
^^^^^^^^^^^^^^^^^^^
Only needed if connecting to `AWS
Redshift <https://aws.amazon.com/redshift/>`__
::
pip install sqlalchemy-redshift
Configuration
-------------
sql-helper uses a settings.ini file for Docker and connection
configuration:
.. code:: ini
[default]
postgresql_image_version = 13-alpine
mysql_image_version = 8.0
postgresql_username = postgresuser
postgresql_password = some.pass
postgresql_db = postgresdb
mysql_username = mysqluser
mysql_password = some.pass
mysql_root_password = root.pass
mysql_db = mysqldb
connect_timeout = 5
sql_url =
[dev]
postgresql_container_name = sql-helper-postgres
mysql_container_name = sql-helper-mysql
postgresql_port = 5432
mysql_port = 3306
postgresql_rm = False
mysql_rm = False
postgresql_data_dir =
mysql_data_dir =
postgresql_url = postgresql://postgresuser:some.pass@localhost:5432/postgresdb
mysql_url = mysql://mysqluser:some.pass@localhost:3306/mysqldb
sqlite_url = sqlite:////tmp/some-dev.db
[test]
postgresql_container_name = sql-helper-postgres-test
mysql_container_name = sql-helper-mysql-test
postgresql_port = 5440
mysql_port = 3310
postgresql_rm = True
mysql_rm = True
postgresql_data_dir =
mysql_data_dir =
postgresql_url = postgresql://postgresuser:some.pass@localhost:5440/postgresdb
mysql_url = mysql://mysqluser:some.pass@localhost:3310/mysqldb
sqlite_url = sqlite:////tmp/some-test.db
..
On first use, the default settings.ini file is copied to
``~/.config/sql-helper/settings.ini``
Use the ``APP_ENV`` environment variable to specify which section of the
``settings.ini`` file your settings will be loaded from. Any settings in
the ``default`` section can be overwritten if explicity set in another
section. If no ``APP_ENV`` is explicitly set, ``dev`` is assumed.
QuickStart
----------
.. code:: python
import sql_helper as sqh
# Connect to a database with automatic Docker container startup if needed
sql = sqh.SQL('postgresql://user:pass@localhost:5432/mydb', attempt_docker=True, wait=True)
# Execute queries with adaptive result formatting
# Single values are returned directly
user_count = sql.execute('SELECT count(*) FROM users') # Returns: 42
# Single columns become simple lists
user_names = sql.execute('SELECT name FROM users LIMIT 3') # Returns: ['Alice', 'Bob', 'Carol']
# Multiple columns become lists of dictionaries
users = sql.execute('SELECT id, name, email FROM users LIMIT 2')
# Returns: [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}, ...]
# Explore schema interactively
tables = sql.get_tables()
columns = sql.get_columns('users', name_only=True)
timestamp_fields = sql.get_timestamp_columns('users', name_only=True)
# Insert data with automatic parameterization
sql.insert('users', {'name': 'David', 'email': 'david@example.com'})
sql.insert('users', [
{'name': 'Eve', 'email': 'eve@example.com'},
{'name': 'Frank', 'email': 'frank@example.com'}
])
# Interactive database selection (prompts user to choose from configured URLs)
selected_url = sqh.select_url_from_settings()
sql = sqh.SQL(selected_url, attempt_docker=True)
What you gain: **Zero-friction database exploration** with automatic
environment setup, consistent result formatting across query types, and
transparent SQL execution that you can inspect and debug. The library
eliminates the cognitive overhead of connection management, driver
selection, and result processing while preserving full control over the
actual SQL being executed.
API Overview
------------
Environment and Configuration Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **``urls_from_settings()``** - Discover configured database
connections
- Returns: List of all configured connection URLs from settings.ini
- Internal calls: None
- **``select_url_from_settings()``** - Interactive database selection
- Returns: User-selected connection URL from configured options
- Internal calls: ``urls_from_settings()``, ``ih.make_selections()``
Docker Container Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **``start_docker(db_type, exception=False, show=False, force=False, wait=True, sleeptime=2)``**
- Launch database containers
- ``db_type``: ‘postgresql’ or ‘mysql’
- ``exception``: Raise exceptions on Docker errors
- ``show``: Display Docker commands and output
- ``force``: Stop and remove existing container before creating new
one
- ``wait``: Block until database accepts connections
- ``sleeptime``: Seconds between connection attempts when waiting
- Returns: Result from Docker operation
- Internal calls: ``bh.tools.docker_postgres_start()``,
``bh.tools.docker_mysql_start()``
- **``stop_docker(db_type, exception=False, show=False)``** - Stop
database containers
- ``db_type``: ‘postgresql’ or ‘mysql’
- ``exception``: Raise exceptions on Docker errors
- ``show``: Display Docker commands and output
- Returns: Result from Docker operation
- Internal calls: ``bh.tools.docker_stop()``
Core Database Operations
~~~~~~~~~~~~~~~~~~~~~~~~
- **``SQL(url, connect_timeout=5, attempt_docker=False, wait=False, **connect_args)``**
- Create a database connection instance
- ``url``: Connection URL (postgresql://, mysql://, sqlite://,
redshift+psycopg2://)
- ``connect_timeout``: Seconds to wait for connection before giving
up
- ``attempt_docker``: Automatically start Docker container if
connection fails and URL matches settings
- ``wait``: Block until Docker container is ready to accept
connections
- ``**connect_args``: Additional arguments passed to underlying
connection engine
- Returns: Configured SQL instance ready for database operations
- Internal calls: ``start_docker()``
- **``SQL.execute(statement, params={})``** - Execute SQL with adaptive
result formatting
- ``statement``: SQL string or path to SQL file
- ``params``: Dictionary or list of dictionaries for parameterized
queries
- Returns: Adaptive results based on query structure: single values
for aggregations, lists for single columns, list of dicts for
multiple columns, single dict/value for single-row results with
parentheses
- Internal calls: None
- **``SQL.insert(table, data)``** - Insert data with automatic
parameterization
- ``table``: Target table name
- ``data``: Dictionary (single row) or list of dictionaries
(multiple rows)
- Returns: Generated INSERT statement string for debugging
- Internal calls: None
- **``SQL.call_procedure(procedure, list_of_params=[])``** - Execute
stored procedures
- ``procedure``: Name of stored procedure
- ``list_of_params``: List of parameters to pass
- Returns: List of results from procedure execution
- Internal calls: None
Schema Discovery and Introspection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **``SQL.get_tables()``** - List all tables in the database
- Returns: List of table names (PostgreSQL returns schema.tablename
format)
- Internal calls: None
- **``SQL.get_schemas(sort=False)``** - List database schemas
(PostgreSQL only)
- ``sort``: Alphabetically sort results
- Returns: List of schema names
- Internal calls: None
- **``SQL.get_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**
- Examine table structure
- ``table``: Table name (supports schema.table notation for
PostgreSQL)
- ``schema``: Schema name (optional, auto-detected from table if
using dot notation)
- ``name_only``: Return simple list of column names instead of
detailed dictionaries
- ``sort``: Alphabetically sort results
- ``**kwargs``: Additional arguments passed to column inspection
- Returns: List of column dictionaries or column names if
name_only=True
- Internal calls: None
- **``SQL.get_indexes(table, schema=None)``** - List table indexes
- ``table``: Table name
- ``schema``: Schema name (optional)
- Returns: List of dictionaries with index information
- Internal calls: None
Specialized Column Analysis
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **``SQL.get_timestamp_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**
- Find date/time columns
- ``table``: Table name
- ``schema``: Schema name (optional)
- ``name_only``: Return simple list of column names instead of
detailed dictionaries
- ``sort``: Alphabetically sort results
- ``**kwargs``: Additional arguments passed to column inspection
- Returns: Columns that are DATE, DATETIME, TIME, or TIMESTAMP types
- Internal calls: ``SQL.get_columns()``
- **``SQL.get_autoincrement_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**
- Find auto-incrementing columns
- ``table``: Table name
- ``schema``: Schema name (optional)
- ``name_only``: Return simple list of column names instead of
detailed dictionaries
- ``sort``: Alphabetically sort results
- ``**kwargs``: Additional arguments passed to column inspection
- Returns: Columns with autoincrement properties
- Internal calls: ``SQL.get_columns()``
- **``SQL.get_required_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**
- Find required columns
- ``table``: Table name
- ``schema``: Schema name (optional)
- ``name_only``: Return simple list of column names instead of
detailed dictionaries
- ``sort``: Alphabetically sort results
- ``**kwargs``: Additional arguments passed to column inspection
- Returns: Columns that are not nullable and have no default value
- Internal calls: ``SQL.get_columns()``
- **``SQL.get_non_nullable_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**
- Find non-nullable columns
- ``table``: Table name
- ``schema``: Schema name (optional)
- ``name_only``: Return simple list of column names instead of
detailed dictionaries
- ``sort``: Alphabetically sort results
- ``**kwargs``: Additional arguments passed to column inspection
- Returns: Columns that cannot contain NULL values
- Internal calls: ``SQL.get_columns()``
Stored Procedure Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **``SQL.get_procedure_names(schema='', sort=False)``** - List stored
procedures
- ``schema``: Schema name (PostgreSQL only)
- ``sort``: Alphabetically sort results
- Returns: List of procedure names
- Internal calls: None
- **``SQL.get_procedure_code(procedure)``** - View procedure source
code
- ``procedure``: Procedure name
- Returns: String containing the procedure definition
- Internal calls: None
Raw data
{
"_id": null,
"home_page": "https://github.com/kenjyco/sql-helper",
"name": "sql-helper",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "sql, data, database, cli, command-line, sqlalchemy, mysql, postgresql, sqlite, helper, kenjyco",
"author": "Ken",
"author_email": "kenjyco@gmail.com",
"download_url": "https://github.com/kenjyco/sql-helper/tarball/v0.1.0",
"platform": null,
"description": "A lightweight, transparent wrapper around SQLAlchemy (both 1.x and 2.x)\ndesigned for interactive database exploration, debugging, testing, and\nREPL-driven development workflows. Rather than building yet another ORM\nor complex abstraction layer, sql-helper trusts you to understand SQL\nand provides transparent, immediate access to databases with minimal\nmental overhead.\n\nIt integrates seamlessly with IPython, supports automatic Docker\ndatabase provisioning, and works across SQLite, MySQL, PostgreSQL, and\nRedshift with consistent APIs that adapt to database-specific behaviors.\nThe library also provides adaptive result formatting based on the query\nstructure. Single values for aggregations, simple lists for single\ncolumns, and lists of dictionaries for multiple columns.\n\nTested for Python 3.6 - 3.13 using both SQLAlchemy 1.x and 2.x against\nPostgreSQL 13 and MySQL 8.0 docker containers.\n\nConnect with a DB url in the following formats:\n\n- ``postgresql://someuser:somepassword@somehost[:someport]/somedatabase``\n- ``mysql://someuser:somepassword@somehost[:someport]/somedatabase``\n\n - *note: urls that start with ``mysql://`` will automatically be\n changed to use ``mysql+pymysql://`` since this packages uses the\n ``pymysql`` driver*\n\n- ``sqlite:///somedb.db``\n- ``redshift+psycopg2://someuser:somepassword@somehost/somedatabase``\n\n - *note: requires separate install of the ``sqlalchemy-redshift``\n package*\n\nInstall\n-------\n\nFirst, ensure that the ``pg_config`` executable is on the system and\nthat the ``cryptography`` dependency can either be built with Rust or\nthe pre-compiled wheel can be used. (*See \u201cDependencies\u201d section below*)\n\nThen install with ``pip``:\n\n::\n\n pip install sql-helper\n\nDependencies\n~~~~~~~~~~~~\n\npg_config for postgresql\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n sudo apt-get install -y libpq-dev\n\nor\n\n::\n\n brew install postgresql\n\ncryptography package\n^^^^^^^^^^^^^^^^^^^^\n\nIf using Python 3.6, be sure to update pip to **at least version\n20.3.4** (default pip is 18.1) so that the pre-compiled wheel for\n``cryptography`` can be used. Otherwise, you will need to install the\n`rust compiler <https://www.rust-lang.org>`__ so that the\n``cryptography`` dependency can be built\n(``curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y``)\n\nIf using Python 3.5, there is no pre-compiled wheel for ``cryptography``\n(even when upgrading pip to version 20.3.4). It also cannot be built if\nthe rust compiler is installed. Support for Python 3.5 is effectively\nremoved.\n\npymysql package\n^^^^^^^^^^^^^^^\n\nAccording to https://nvd.nist.gov/vuln/detail/CVE-2024-36039, pymysql\nversions below 1.1.1 are vulnerable to SQL injection. Version 1.1.1 is\nonly available for Python 3.7+ (final version for Python 3.6 is 1.0.2;\nfinal working version for Python 3.5 is 0.9.3).\n\nsqlalchemy-redshift\n^^^^^^^^^^^^^^^^^^^\n\nOnly needed if connecting to `AWS\nRedshift <https://aws.amazon.com/redshift/>`__\n\n::\n\n pip install sqlalchemy-redshift\n\nConfiguration\n-------------\n\nsql-helper uses a settings.ini file for Docker and connection\nconfiguration:\n\n.. code:: ini\n\n [default]\n postgresql_image_version = 13-alpine\n mysql_image_version = 8.0\n postgresql_username = postgresuser\n postgresql_password = some.pass\n postgresql_db = postgresdb\n mysql_username = mysqluser\n mysql_password = some.pass\n mysql_root_password = root.pass\n mysql_db = mysqldb\n connect_timeout = 5\n sql_url =\n\n [dev]\n postgresql_container_name = sql-helper-postgres\n mysql_container_name = sql-helper-mysql\n postgresql_port = 5432\n mysql_port = 3306\n postgresql_rm = False\n mysql_rm = False\n postgresql_data_dir =\n mysql_data_dir =\n postgresql_url = postgresql://postgresuser:some.pass@localhost:5432/postgresdb\n mysql_url = mysql://mysqluser:some.pass@localhost:3306/mysqldb\n sqlite_url = sqlite:////tmp/some-dev.db\n\n [test]\n postgresql_container_name = sql-helper-postgres-test\n mysql_container_name = sql-helper-mysql-test\n postgresql_port = 5440\n mysql_port = 3310\n postgresql_rm = True\n mysql_rm = True\n postgresql_data_dir =\n mysql_data_dir =\n postgresql_url = postgresql://postgresuser:some.pass@localhost:5440/postgresdb\n mysql_url = mysql://mysqluser:some.pass@localhost:3310/mysqldb\n sqlite_url = sqlite:////tmp/some-test.db\n\n..\n\n On first use, the default settings.ini file is copied to\n ``~/.config/sql-helper/settings.ini``\n\nUse the ``APP_ENV`` environment variable to specify which section of the\n``settings.ini`` file your settings will be loaded from. Any settings in\nthe ``default`` section can be overwritten if explicity set in another\nsection. If no ``APP_ENV`` is explicitly set, ``dev`` is assumed.\n\nQuickStart\n----------\n\n.. code:: python\n\n import sql_helper as sqh\n\n # Connect to a database with automatic Docker container startup if needed\n sql = sqh.SQL('postgresql://user:pass@localhost:5432/mydb', attempt_docker=True, wait=True)\n\n # Execute queries with adaptive result formatting\n # Single values are returned directly\n user_count = sql.execute('SELECT count(*) FROM users') # Returns: 42\n\n # Single columns become simple lists\n user_names = sql.execute('SELECT name FROM users LIMIT 3') # Returns: ['Alice', 'Bob', 'Carol']\n\n # Multiple columns become lists of dictionaries\n users = sql.execute('SELECT id, name, email FROM users LIMIT 2')\n # Returns: [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}, ...]\n\n # Explore schema interactively\n tables = sql.get_tables()\n columns = sql.get_columns('users', name_only=True)\n timestamp_fields = sql.get_timestamp_columns('users', name_only=True)\n\n # Insert data with automatic parameterization\n sql.insert('users', {'name': 'David', 'email': 'david@example.com'})\n sql.insert('users', [\n {'name': 'Eve', 'email': 'eve@example.com'},\n {'name': 'Frank', 'email': 'frank@example.com'}\n ])\n\n # Interactive database selection (prompts user to choose from configured URLs)\n selected_url = sqh.select_url_from_settings()\n sql = sqh.SQL(selected_url, attempt_docker=True)\n\nWhat you gain: **Zero-friction database exploration** with automatic\nenvironment setup, consistent result formatting across query types, and\ntransparent SQL execution that you can inspect and debug. The library\neliminates the cognitive overhead of connection management, driver\nselection, and result processing while preserving full control over the\nactual SQL being executed.\n\nAPI Overview\n------------\n\nEnvironment and Configuration Management\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``urls_from_settings()``** - Discover configured database\n connections\n\n - Returns: List of all configured connection URLs from settings.ini\n - Internal calls: None\n\n- **``select_url_from_settings()``** - Interactive database selection\n\n - Returns: User-selected connection URL from configured options\n - Internal calls: ``urls_from_settings()``, ``ih.make_selections()``\n\nDocker Container Management\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``start_docker(db_type, exception=False, show=False, force=False, wait=True, sleeptime=2)``**\n - Launch database containers\n\n - ``db_type``: \u2018postgresql\u2019 or \u2018mysql\u2019\n - ``exception``: Raise exceptions on Docker errors\n - ``show``: Display Docker commands and output\n - ``force``: Stop and remove existing container before creating new\n one\n - ``wait``: Block until database accepts connections\n - ``sleeptime``: Seconds between connection attempts when waiting\n - Returns: Result from Docker operation\n - Internal calls: ``bh.tools.docker_postgres_start()``,\n ``bh.tools.docker_mysql_start()``\n\n- **``stop_docker(db_type, exception=False, show=False)``** - Stop\n database containers\n\n - ``db_type``: \u2018postgresql\u2019 or \u2018mysql\u2019\n - ``exception``: Raise exceptions on Docker errors\n - ``show``: Display Docker commands and output\n - Returns: Result from Docker operation\n - Internal calls: ``bh.tools.docker_stop()``\n\nCore Database Operations\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``SQL(url, connect_timeout=5, attempt_docker=False, wait=False, **connect_args)``**\n - Create a database connection instance\n\n - ``url``: Connection URL (postgresql://, mysql://, sqlite://,\n redshift+psycopg2://)\n - ``connect_timeout``: Seconds to wait for connection before giving\n up\n - ``attempt_docker``: Automatically start Docker container if\n connection fails and URL matches settings\n - ``wait``: Block until Docker container is ready to accept\n connections\n - ``**connect_args``: Additional arguments passed to underlying\n connection engine\n - Returns: Configured SQL instance ready for database operations\n - Internal calls: ``start_docker()``\n\n- **``SQL.execute(statement, params={})``** - Execute SQL with adaptive\n result formatting\n\n - ``statement``: SQL string or path to SQL file\n - ``params``: Dictionary or list of dictionaries for parameterized\n queries\n - Returns: Adaptive results based on query structure: single values\n for aggregations, lists for single columns, list of dicts for\n multiple columns, single dict/value for single-row results with\n parentheses\n - Internal calls: None\n\n- **``SQL.insert(table, data)``** - Insert data with automatic\n parameterization\n\n - ``table``: Target table name\n - ``data``: Dictionary (single row) or list of dictionaries\n (multiple rows)\n - Returns: Generated INSERT statement string for debugging\n - Internal calls: None\n\n- **``SQL.call_procedure(procedure, list_of_params=[])``** - Execute\n stored procedures\n\n - ``procedure``: Name of stored procedure\n - ``list_of_params``: List of parameters to pass\n - Returns: List of results from procedure execution\n - Internal calls: None\n\nSchema Discovery and Introspection\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``SQL.get_tables()``** - List all tables in the database\n\n - Returns: List of table names (PostgreSQL returns schema.tablename\n format)\n - Internal calls: None\n\n- **``SQL.get_schemas(sort=False)``** - List database schemas\n (PostgreSQL only)\n\n - ``sort``: Alphabetically sort results\n - Returns: List of schema names\n - Internal calls: None\n\n- **``SQL.get_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**\n - Examine table structure\n\n - ``table``: Table name (supports schema.table notation for\n PostgreSQL)\n - ``schema``: Schema name (optional, auto-detected from table if\n using dot notation)\n - ``name_only``: Return simple list of column names instead of\n detailed dictionaries\n - ``sort``: Alphabetically sort results\n - ``**kwargs``: Additional arguments passed to column inspection\n - Returns: List of column dictionaries or column names if\n name_only=True\n - Internal calls: None\n\n- **``SQL.get_indexes(table, schema=None)``** - List table indexes\n\n - ``table``: Table name\n - ``schema``: Schema name (optional)\n - Returns: List of dictionaries with index information\n - Internal calls: None\n\nSpecialized Column Analysis\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``SQL.get_timestamp_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**\n - Find date/time columns\n\n - ``table``: Table name\n - ``schema``: Schema name (optional)\n - ``name_only``: Return simple list of column names instead of\n detailed dictionaries\n - ``sort``: Alphabetically sort results\n - ``**kwargs``: Additional arguments passed to column inspection\n - Returns: Columns that are DATE, DATETIME, TIME, or TIMESTAMP types\n - Internal calls: ``SQL.get_columns()``\n\n- **``SQL.get_autoincrement_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**\n - Find auto-incrementing columns\n\n - ``table``: Table name\n - ``schema``: Schema name (optional)\n - ``name_only``: Return simple list of column names instead of\n detailed dictionaries\n - ``sort``: Alphabetically sort results\n - ``**kwargs``: Additional arguments passed to column inspection\n - Returns: Columns with autoincrement properties\n - Internal calls: ``SQL.get_columns()``\n\n- **``SQL.get_required_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**\n - Find required columns\n\n - ``table``: Table name\n - ``schema``: Schema name (optional)\n - ``name_only``: Return simple list of column names instead of\n detailed dictionaries\n - ``sort``: Alphabetically sort results\n - ``**kwargs``: Additional arguments passed to column inspection\n - Returns: Columns that are not nullable and have no default value\n - Internal calls: ``SQL.get_columns()``\n\n- **``SQL.get_non_nullable_columns(table, schema=None, name_only=False, sort=False, **kwargs)``**\n - Find non-nullable columns\n\n - ``table``: Table name\n - ``schema``: Schema name (optional)\n - ``name_only``: Return simple list of column names instead of\n detailed dictionaries\n - ``sort``: Alphabetically sort results\n - ``**kwargs``: Additional arguments passed to column inspection\n - Returns: Columns that cannot contain NULL values\n - Internal calls: ``SQL.get_columns()``\n\nStored Procedure Management\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- **``SQL.get_procedure_names(schema='', sort=False)``** - List stored\n procedures\n\n - ``schema``: Schema name (PostgreSQL only)\n - ``sort``: Alphabetically sort results\n - Returns: List of procedure names\n - Internal calls: None\n\n- **``SQL.get_procedure_code(procedure)``** - View procedure source\n code\n\n - ``procedure``: Procedure name\n - Returns: String containing the procedure definition\n - Internal calls: None\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Helper funcs and tools for working with SQL in mysql, postgresql, and more",
"version": "0.1.0",
"project_urls": {
"Download": "https://github.com/kenjyco/sql-helper/tarball/v0.1.0",
"Homepage": "https://github.com/kenjyco/sql-helper"
},
"split_keywords": [
"sql",
" data",
" database",
" cli",
" command-line",
" sqlalchemy",
" mysql",
" postgresql",
" sqlite",
" helper",
" kenjyco"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "053030dca9687797f37f22265ea734458d6c37e5d4f5aa8918d3296b2f225b19",
"md5": "f2e345d71dc2f7e231636b1b3c81166b",
"sha256": "9f9362c65b1d2e29365015c2357ab4c1c10f59f4ca4954579cd7e0c802b97937"
},
"downloads": -1,
"filename": "sql_helper-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2e345d71dc2f7e231636b1b3c81166b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16018,
"upload_time": "2025-07-23T18:22:56",
"upload_time_iso_8601": "2025-07-23T18:22:56.816224Z",
"url": "https://files.pythonhosted.org/packages/05/30/30dca9687797f37f22265ea734458d6c37e5d4f5aa8918d3296b2f225b19/sql_helper-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 18:22:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kenjyco",
"github_project": "sql-helper",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "bg-helper",
"specs": []
},
{
"name": "click",
"specs": [
[
">=",
"6.0"
]
]
},
{
"name": "cryptography",
"specs": []
},
{
"name": "psycopg2-binary",
"specs": [
[
"<",
"3"
],
[
">=",
"2.8"
]
]
},
{
"name": "settings-helper",
"specs": []
},
{
"name": "pymysql",
"specs": [
[
">=",
"1.1.1"
]
]
},
{
"name": "pymysql",
"specs": [
[
">=",
"0.9.3"
]
]
},
{
"name": "sqlalchemy",
"specs": [
[
"!=",
"2.0.29"
],
[
"!=",
"2.0.18"
],
[
"!=",
"2.0.14"
],
[
"!=",
"2.0.2"
],
[
"!=",
"2.0.27"
],
[
"!=",
"2.0.19"
],
[
"!=",
"2.0.16"
],
[
"!=",
"2.0.1"
],
[
"!=",
"2.0.21"
],
[
"!=",
"2.0.5.post1"
],
[
"!=",
"2.0.24"
],
[
"!=",
"2.0.11"
],
[
"!=",
"2.0.26"
],
[
"!=",
"2.0.10"
],
[
"!=",
"2.0.25"
],
[
"!=",
"2.0.3"
],
[
"!=",
"2.0.28"
],
[
"!=",
"2.0.22"
],
[
"!=",
"2.0.9"
],
[
"!=",
"2.0.13"
],
[
"!=",
"2.0.4"
],
[
"!=",
"2.0.6"
],
[
"!=",
"2.0.20"
],
[
"!=",
"2.0.17"
],
[
"!=",
"2.0.23"
],
[
"!=",
"2.0.12"
],
[
">=",
"1.3"
],
[
"!=",
"2.0.15"
],
[
"!=",
"2.0.8"
],
[
"!=",
"2.0.30"
],
[
"!=",
"2.0.0"
],
[
"!=",
"2.0.7"
]
]
},
{
"name": "sqlalchemy",
"specs": [
[
">=",
"1.3"
]
]
}
],
"lcname": "sql-helper"
}