Skip to main content

Convert attrs class to CREATE TABLE command.

Project description

attrs to sql

Convert attrs class to sql CREATE TABLE command.


Define class decorated with attr.s:

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



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.

Files for attrs-to-sql, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size attrs_to_sql-0.2.0-py3-none-any.whl (8.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size attrs_to_sql-0.2.0.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page