Exemple #1
0
                        SDSS_DR13_PhotoObj, TIC_v8, TwoMassPSC, Tycho2)


class DeprecatedModel(BaseModel):
    class Meta:
        database = database
        schema = 'deprecated'
        primary_key = False
        use_reflection = True
        reflection_options = {
            'skip_foreign_keys': True,
            'use_peewee_reflection': False
        }


_APOGEE_Star_Visit_Deferred = DeferredThroughModel()


class GalacticGenesis(DeprecatedModel):
    class Meta:
        table_name = 'galactic_genesis'


class GalacticGenesisBig(DeprecatedModel):
    class Meta:
        table_name = 'galactic_genesis_big'


class SDSS_DR14_APOGEE_Visit(DeprecatedModel):

    visit_id = TextField(primary_key=True)
Exemple #2
0
        only_save_dirty = True
        legacy_table_names = False


class Company(BaseModel):
    name = CharField()
    code = CharField()

    class Meta:
        table_alias = 'c'

    def __str__(self):
        return self.name


UserRoleDeferred = DeferredThroughModel()
ApproverCompanyDeferred = DeferredThroughModel()


class Role(BaseModel, RoleMixin):
    name = CharField(unique=True)
    description = TextField(null=True)

    class Meta:
        table_alias = 'r'



class User(BaseModel, UserMixin):
    username = CharField(unique=True, index=True)
    password = CharField()
Exemple #3
0
from .. import BaseModel
from . import database


class CatalogdbModel(BaseModel):

    class Meta:
        database = database
        schema = 'catalogdb'
        primary_key = False
        use_reflection = True
        reflection_options = {'skip_foreign_keys': True,
                              'use_peewee_reflection': False}


_Gaia_DR2_TwoMass_Deferred = DeferredThroughModel()
_APOGEE_Star_Visit_Deferred = DeferredThroughModel()


class Version(CatalogdbModel):
    """Model for the version table."""

    id = AutoField()
    plan = TextField(null=False)
    tag = TextField(null=False)

    class Meta:
        table_name = 'version'
        use_reflection = False

Exemple #4
0
database_url = os.getenv(
    'DATABASE_URL', 'postgresql://*****:*****@localhost:5432/isbn_metadata')
database = connect(database_url)


class BaseModel(Model):
    class Meta:
        database = database


class Author(BaseModel):
    id = PrimaryKeyField(null=False)
    name = CharField(max_length=255, unique=True)


AuthorThroughDeferred = DeferredThroughModel()


class Book(BaseModel):
    id = PrimaryKeyField(null=False)
    google_book_id = CharField(max_length=12, unique=True)
    title = CharField(max_length=255)
    subtitle = CharField(max_length=255, null=True)
    description = TextField(null=True)
    published_date = CharField(max_length=45, null=True)
    isbn_10 = CharField(max_length=10, null=True, unique=True)
    isbn_13 = CharField(max_length=13, null=True, unique=True)
    publisher = CharField(max_length=255, null=True)
    page_count = CharField(max_length=45, null=True)
    print_type = CharField(max_length=45, null=True)
    language = CharField(max_length=45, null=True)
Exemple #5
0
    last_name = CharField(null=True)
    first_name = CharField(null=True)
    middle_name = CharField(null=True)

    def __repr__(self):
        return "Author({}, {}, {})".format(
            self.last_name,
            self.first_name,
            self.middle_name)

    def __str__(self):
        return repr(self)


BookAuthorsDeferred = DeferredThroughModel()


class Book(BaseModel):
    book_id = IntegerField(index=True)

    title = CharField()
    subtitle = CharField(null=True)
    language = CharField(null=True)
    year = IntegerField(null=True)
    series = CharField(null=True)

    authors = ManyToManyField(
        Author,
        backref="books",
        through_model=BookAuthorsDeferred)
Exemple #6
0
    class Meta:
        db_table = 'survey'
        schema = 'platedb'


class PlateStatus(OperationsDBModel):
    label = TextField(null=True, unique=True)
    pk = PrimaryKeyField()

    class Meta:
        db_table = 'plate_status'
        schema = 'platedb'


PlateSurveyThroughModel = DeferredThroughModel()
PlateStatusThroughModel = DeferredThroughModel()


class Plate(OperationsDBModel):

    chunk = TextField(null=True)
    comment = TextField(null=True)
    current_survey_mode = ForeignKeyField(column_name='current_survey_mode_pk',
                                          null=True,
                                          model=SurveyMode,
                                          field='pk')
    design = ForeignKeyField(column_name='design_pk',
                             null=True,
                             model=Design,
                             backref='plates',
Exemple #7
0
    Series = CharField(null=True)
    Year = IntegerField(null=True)
    Month = IntegerField(null=True)
    UserLastPageRead = IntegerField()
    UserCurrentPage = IntegerField()
    PageCount = IntegerField()
    Summary = TextField(null=True)
    FilePath = CharField(null=True)
    Volume = CharField(null=True)
    data = PickleField(null=True)
    local_file = CharField(null=True)
    is_sync = BooleanField(default=False)
    been_sync = BooleanField(default=False)


ComicIndexDeferred = DeferredThroughModel()


class ReadingList(BaseModel):
    name = CharField()
    slug = CharField(primary_key=True)
    data = PickleField(null=True)
    comics = ManyToManyField(Comic,
                             backref="readinglists",
                             through_model=ComicIndexDeferred)
    cb_limit_active = BooleanField(null=True)
    limit_num = IntegerField(null=True)
    cb_only_read_active = BooleanField(null=True)
    cb_purge_active = BooleanField(null=True)
    cb_optimize_size_active = BooleanField(null=True)
    sw_syn_this_active = BooleanField(null=True)
Exemple #8
0
                    DeferredThroughModel, DoubleField, FloatField,
                    ForeignKeyField, IntegerField, ManyToManyField,
                    SmallIntegerField, TextField)
from playhouse.postgres_ext import ArrayField

from .. import BaseModel
from . import catalogdb, database  # noqa


class TargetdbBase(BaseModel):
    class Meta:
        schema = 'targetdb'
        database = database


AssignmentDeferred = DeferredThroughModel()
CartonToTargetDeferred = DeferredThroughModel()


class Version(TargetdbBase):
    plan = TextField()
    pk = AutoField()
    target_selection = BooleanField()
    robostrategy = BooleanField()
    tag = TextField()

    class Meta:
        table_name = 'version'


class Cadence(TargetdbBase):