Skip to main content

Allows you to check if a given string can be PostgreSQL column name

Project description

I found it weird there's no simple way to check if a given string can be a PostgreSQL column name. Although, to my understanding, you can escape with quotation marks some names that are otherwise invalid, I don't think escaping such a thing is a good idea.

This validation is required if your column name can be dynamically generated.

How to use

>>> from is_valid_postgres_column_name import is_valid_postgres_column_name
>>> is_valid_postgres_column_name("column_A")
>>> True
>>> is_valid_postgres_column_name("1column_A")
>>> False

All PostgreSQL versions are supported. The only difference between versions, to my knowledge, are reserved keywords.

>>> is_valid_postgres_column_name("column_A", version=7.1)
>>> True

Installation

$ pip install -U is_valid_postgres_column_name

Requirements

Python 3.0+

Dependencies

None.

Contribution

Welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

is_valid_postgres_column_name-0.0.2.tar.gz (5.7 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page