Skip to content

Commit

Permalink
Merge pull request #36 from sdss/bhm_feat1
Browse files Browse the repository at this point in the history
Explicily force catalogdb.sdss_dr16_qso.psfmag to become a peewee ArrayField.
  • Loading branch information
tdwelly committed Jul 21, 2020
2 parents b4df9c1 + 7b3b2e1 commit ff82a73
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This document records the main changes to the ``sdssdb`` code.

* :release:`0.4.5 <2020-07-12>`
* Add ``ForeignKeyField`` from ``CatalogToSDSS_DR13_PhotoObj_Primary`` directly to ``SDSS_DR13_PhotoObj``.
* Add single precision float type to the list of Peewee arrays during reflection.

* :release:`0.4.4 <2020-07-07>`
* Add ``ForeignKeyField`` to ``TIC_v8`` where for all models in ``catalogdb`` connected to Gaia.
Expand Down
6 changes: 6 additions & 0 deletions python/sdssdb/etc/sdssdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ slore:
host: lore.sdss.utah.edu
port: 5432
domain: lore.sdss.utah.edu

tunnel_operations:
user: sdss_user
admin: sdss
host: localhost
port: 7502
4 changes: 4 additions & 0 deletions python/sdssdb/peewee/sdss5db/catalogdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
DeferredThroughModel, DoubleField, FloatField,
ForeignKeyField, IntegerField, ManyToManyField, TextField)

from playhouse.postgres_ext import ArrayField

from sdssdb.exceptions import SdssdbUserWarning

from .. import BaseModel
Expand Down Expand Up @@ -240,6 +242,8 @@ class Meta:

class SDSS_DR16_QSO(SDSS_DR14_QSO):

psfmag = ArrayField(field_class=FloatField, null=True)

class Meta:
table_name = 'sdss_dr16_qso'

Expand Down
3 changes: 2 additions & 1 deletion python/sdssdb/utils/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sys
import time

from peewee import DoubleField
from peewee import DoubleField, FloatField
from playhouse.reflection import PostgresqlMetadata, UnknownField


Expand Down Expand Up @@ -284,6 +284,7 @@ def get_database_columns(database, schema=None):
column_map = pg_metadata.column_map

# Add array type for double
pg_metadata.array_types[1021] = FloatField
pg_metadata.array_types[1022] = DoubleField

# Get the mapping of oid to relation (table)
Expand Down

0 comments on commit ff82a73

Please sign in to comment.