Convert attrs class to CREATE TABLE command.
Project description
attrs to sql
Convert attrs class to sql CREATE TABLE
command.
Usage
Define class decorated with attr.s
:
@attr.s(auto_attribs=True)
class Model:
id: int = attr.ib(metadata={"primary_key": True})
name: str = attr.ib(metadata={"not_null": True, "length": 30})
floats: List[float] = attr.ib(factory=list)
Run attrs_to_table
with defined class:
from attrs_to_sql import attrs_to_table
attrs_to_table(Model)
Output:
CREATE TABLE public.model
(
id int PRIMARY KEY,
name varchar(30) NOT NULL,
floats float[]
);
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
attrs_to_sql-0.2.0.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file attrs_to_sql-0.2.0.tar.gz
.
File metadata
- Download URL: attrs_to_sql-0.2.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff1380b4996deb1800f44d40601f6056b217203ab1ae7c1233d279982751585d |
|
MD5 | ab1b56052b872035c30d8ea7d7cbba4d |
|
BLAKE2b-256 | 0a7376e27191bd81c84defdf685b8d0d3419216a8cbf08c84cc62fd3f08a5e9d |
File details
Details for the file attrs_to_sql-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: attrs_to_sql-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1cedc552e639818ad2360a677c6a904c4a598778261f9c8ac4c50b78b90b7c |
|
MD5 | 48ddf6310202f8ee0181df9e66202d12 |
|
BLAKE2b-256 | 6fd7c9f001687427abb88206e91d81ba60533d8636103bfde7ade3a8e4782000 |