Skip to content

Commit

Permalink
Prepare to rename master->main
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Nov 6, 2020
1 parent 48b992b commit 08ad17d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python application

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ notifications:

# repo branches to test
branches:
- master
- main

install:
- pip install -U pip wheel --quiet
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sdssdb
======

|python| |docs| |travis|
|python| |docs| |travis|

`SDSS <https://sdss.org>`__ product for database management.

Expand Down Expand Up @@ -31,7 +31,7 @@ How to use
:scale: 100%
:target: https://sdssdb.readthedocs.io/en/latest/?badge=latest

.. |travis| image:: https://travis-ci.org/sdss/sdssdb.svg?branch=master
.. |travis| image:: https://travis-ci.org/sdss/sdssdb.svg?branch=main
:target: https://travis-ci.org/sdss/sdssdb

.. |Python application| image:: https://github.com/sdss/sdssdb/workflows/Python%20application/badge.svg
8 changes: 4 additions & 4 deletions docs/sphinx/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Contributing to sdssdb
======================

Contributions to ``sdssdb`` are most welcome. Product development happens on its `GitHub repository <https://www.github.com/sdss/sdssdb>`__. For details on how to develop for an SDSS product refer to the `coding style guide <https://sdss-python-template.readthedocs.io/en/latest/standards.html>`__. All contributions to ``sdssdb`` need to be done as pull requests against the master branch.
Contributions to ``sdssdb`` are most welcome. Product development happens on its `GitHub repository <https://www.github.com/sdss/sdssdb>`__. For details on how to develop for an SDSS product refer to the `coding style guide <https://sdss-python-template.readthedocs.io/en/latest/standards.html>`__. All contributions to ``sdssdb`` need to be done as pull requests against the ``main`` branch.


Contributing a new database or schema
Expand Down Expand Up @@ -42,7 +42,7 @@ how to fill out those files depending on the library used.
Peewee
^^^^^^

For an example of how to implement a database with Peewee you can look at the `sdss5db <https://github.com/sdss/sdssdb/tree/master/python/sdssdb/peewee/sdss5db>`__ implementation. Let's start with the database connection in the ``__init__.py`` file. The basic structure is quite simple and would look something like ::
For an example of how to implement a database with Peewee you can look at the `sdss5db <https://github.com/sdss/sdssdb/tree/main/python/sdssdb/peewee/sdss5db>`__ implementation. Let's start with the database connection in the ``__init__.py`` file. The basic structure is quite simple and would look something like ::

from sdssdb.connection import PeeweeDatabaseConnection
from sdssdb.peewee import BaseModel
Expand Down Expand Up @@ -100,7 +100,7 @@ To define a base class with reflection we do ::
schema = 'stupendous'
table_name = 'stupendous_table'

When the connection is created this model will be reflected and autocompleted with all the columns that exist in the table. The reflection will include the `foreign keys <peewee:ForeignKeyField>` that have been defined for the table in the database. Sometimes this is not desirable and we'd rather create them manually. In this case we can add the attribute ``reflection_options = {'skip_foreign_keys': True}`` to ``Meta`` in the ``ReflectBaseModel``. You can check the `catalogdb <https://github.com/sdss/sdssdb/blob/master/python/sdssdb/peewee/sdss5db/catalogdb.py>`__ models for an implementation of this type.
When the connection is created this model will be reflected and autocompleted with all the columns that exist in the table. The reflection will include the `foreign keys <peewee:ForeignKeyField>` that have been defined for the table in the database. Sometimes this is not desirable and we'd rather create them manually. In this case we can add the attribute ``reflection_options = {'skip_foreign_keys': True}`` to ``Meta`` in the ``ReflectBaseModel``. You can check the `catalogdb <https://github.com/sdss/sdssdb/blob/main/python/sdssdb/peewee/sdss5db/catalogdb.py>`__ models for an implementation of this type.

If a model inherits from a base model using `.ReflectMeta`, it is possible to call ``Model.reflect`` manually to trigger a model reflection. This works even if ``use_reflection=False``.

Expand All @@ -110,7 +110,7 @@ The default Peewee reflection process requires multiple queries against the data
SQLAlchemy
^^^^^^^^^^

Creating a database connection and model classes for SQLALchemy is quite similar to Peewee. As before, refer to the implementation of `sdss5db <https://github.com/sdss/sdssdb/tree/master/python/sdssdb/sqlalchemy/sdss5db>`__ for a good example. In this case the ``__init__.py`` file would look like ::
Creating a database connection and model classes for SQLALchemy is quite similar to Peewee. As before, refer to the implementation of `sdss5db <https://github.com/sdss/sdssdb/tree/main/python/sdssdb/sqlalchemy/sdss5db>`__ for a good example. In this case the ``__init__.py`` file would look like ::

from sdssdb.connection import SQLADatabaseConnection
from sqlalchemy.ext.declarative import declarative_base, DeferredReflection
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ and follow the instructions above to be sure it has been loaded. Remember that `

or for a development version ::

sdss_install --github sdssdb master
sdss_install --github sdssdb main

More instructions on how to install and use ``sdss_install`` are available `here <https://wiki.sdss.org/display/knowledge/sdss_install+bootstrap+installation+instructions>`__.
6 changes: 3 additions & 3 deletions docs/sphinx/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ Note that the level of readiness is not necessarily identical in both Peewee and
<td class="active">catalogdb</td>
<td class="success"></td>
<td class="danger"></td>
<td align="center"><a class="glyphicon glyphicon-download-alt" href="https://github.com/sdss/sdssdb/raw/master/schema/sdss5db/catalogdb/sdss5db.catalogdb.pdf" alt="catalogdb full version"></a> <a class="glyphicon glyphicon-download-alt" style="color:green" href="https://github.com/sdss/sdssdb/raw/master/schema/sdss5db/catalogdb/sdss5db.catalogdb_lite.pdf" alt="catalogdb reduced version"></td>
<td align="center"><a class="glyphicon glyphicon-download-alt" href="https://github.com/sdss/sdssdb/raw/main/schema/sdss5db/catalogdb/sdss5db.catalogdb.pdf" alt="catalogdb full version"></a> <a class="glyphicon glyphicon-download-alt" style="color:green" href="https://github.com/sdss/sdssdb/raw/main/schema/sdss5db/catalogdb/sdss5db.catalogdb_lite.pdf" alt="catalogdb reduced version"></td>
</tr>
<tr>
<td></td>
<td class="active">targetdb</td>
<td class="success"></td>
<td class="danger"></td>
<td align="center"><a class="glyphicon glyphicon-download-alt" href="https://github.com/sdss/sdssdb/raw/master/schema/sdss5db/targetdb/sdss5db.targetdb.pdf"></a></td>
<td align="center"><a class="glyphicon glyphicon-download-alt" href="https://github.com/sdss/sdssdb/raw/main/schema/sdss5db/targetdb/sdss5db.targetdb.pdf"></a></td>
</tr>
<tr>
<td class="active">archive</td>
Expand Down Expand Up @@ -213,7 +213,7 @@ where ``XXXX``, ``YYYY``, etc are the associated passwords for each set of param
Supported Profiles
------------------

The following `profiles <https://github.com/sdss/sdssdb/blob/master/python/sdssdb/etc/sdssdb.yml>`__ are included with sdssdb. When a :ref:`database connection <conn-db>` is created without an explicit profile, the hostname of the current machine is used to find the best possible profile. Profiles can be added or modified by creating a YAML file in ``~/.config/sdss/sdssdb.yaml`` with the same structure.
The following `profiles <https://github.com/sdss/sdssdb/blob/main/python/sdssdb/etc/sdssdb.yml>`__ are included with sdssdb. When a :ref:`database connection <conn-db>` is created without an explicit profile, the hostname of the current machine is used to find the best possible profile. Profiles can be added or modified by creating a YAML file in ``~/.config/sdss/sdssdb.yaml`` with the same structure.

* **local**: a generic localhost profile. Used if the hostname does not match any other profile.
* **apo**: a user on the APO machines.
Expand Down

0 comments on commit 08ad17d

Please sign in to comment.