# Path: plenario/database.py
# def create_database(bind: Engine, database: str) -> None:
# def drop_database(bind: Engine, database: str) -> None:
# def create_extension(bind: Engine, extension: str) -> None:
# def psql(path: str) -> None:
# def postgres_session_context():
# def redshift_session_context():
# 
# Path: plenario/utils/helpers.py
# def slugify(text: str, delimiter: str = '_') -> str:
#     return _slugify(text, separator=delimiter)


from datetime import datetime
from flask_bcrypt import Bcrypt
from geoalchemy2 import Geometry
from sqlalchemy import Boolean, Column, Date, Integer, String, Table, Text, func, select
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import NullType
from plenario.database import postgres_base, postgres_session
from plenario.utils.helpers import slugify
    human_name = Column(String, nullable=False)
    source_url = Column(String)
    view_url = Column(String)
    date_added = Column(Date, nullable=False)

    # Organization that published this dataset
    attribution = Column(String)
    description = Column(Text)
    update_freq = Column(String(100), nullable=False)

    # Who submitted this dataset?
    contributor_name = Column(String)
    contributor_organization = Column(String)
    contributor_email = Column(String)

    # Has an admin signed off on it?
    approved_status = Column(Boolean)

    # We always ingest geometric data as 4326
    bbox = Column(Geometry('POLYGON', srid=4326))
    # How many shape records are present?
    num_shapes = Column(Integer)
    # False when admin first submits metadata.
    # Will become true if ETL completes successfully.
    is_ingested = Column(Boolean, nullable=False)
    # foreign key of celery task responsible for shapefile's ingestion
    celery_task_id = Column(String)

    @classmethod
    def get_by_dataset_name(cls, name):

# Path: plenario/database.py
# def create_database(bind: Engine, database: str) -> None:
# def drop_database(bind: Engine, database: str) -> None:
# def create_extension(bind: Engine, extension: str) -> None:
# def psql(path: str) -> None:
# def postgres_session_context():
# def redshift_session_context():
# 
# Path: plenario/utils/helpers.py
# def slugify(text: str, delimiter: str = '_') -> str:
#     return _slugify(text, separator=delimiter)


# Path: plenario/models/ShapeMetadata.py
from datetime import datetime
from flask_bcrypt import Bcrypt
from geoalchemy2 import Geometry
from sqlalchemy import Boolean, Column, Date, Integer, String, Table, Text, func, select
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import NullType
from plenario.database import postgres_base, postgres_session
from plenario.utils.helpers import slugify

    human_name = Column(String, nullable=False)
    source_url = Column(String)
    view_url = Column(String)
    date_added = Column(Date, nullable=False)

    # Organization that published this dataset
    attribution = Column(String)
    description = Column(Text)
    update_freq = Column(String(100), nullable=False)

    # Who submitted this dataset?
    contributor_name = Column(String)
    contributor_organization = Column(String)
    contributor_email = Column(String)

    # Has an admin signed off on it?
    approved_status = Column(Boolean)

    # We always ingest geometric data as 4326
    bbox = Column(Geometry('POLYGON', srid=4326))
    # How many shape records are present?
    num_shapes = Column(Integer)
    # False when admin first submits metadata.
    # Will become true if ETL completes successfully.
    is_ingested = Column(Boolean, nullable=False)
    # foreign key of celery task responsible for shapefile's ingestion
    celery_task_id = Column(String)

    @classmethod
    def get_by_dataset_name(cls, name):

        shape_metatable = postgres_session.query(cls).filter(cls.dataset_name == name).first()