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.
Metadata
Release files for is-valid-postgres-column-name 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| is_valid_postgres_column_name-0.0.2.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| is_valid_postgres_column_name-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / is_valid_postgres_column_name-0.0.2.tar.gz
| Download URL | is_valid_postgres_column_name-0.0.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f9f39fccfc4248aa85163c51a660df5a8990097500f178429d871312b6491d6
|
|
BLAKE2b-256 checksum How to use checksums |
91c0df47cfdc709ca6dc667398b1f314f0b70c7ecc9710de4c9098a0129203b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / is_valid_postgres_column_name-0.0.2-py3-none-any.whl
| Download URL | is_valid_postgres_column_name-0.0.2-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb3d96606a54993b88a3c9ee67b48afb7cd85d4b9f7c99187ea0aa0caf288c21
|
|
BLAKE2b-256 checksum How to use checksums |
b7e615d35282a4401f8696168870d0c83468e18c20a8f669c2f2a26c5038d52a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|