-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tickets/obsproc 110 #104
Tickets/obsproc 110 #104
Changes from all commits
0ad8304
b0ed833
dc1973e
e879f86
92d73c6
c3aeaa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""add partner column in the proposal table and partner table | ||
Check warning Code scanning / Pylint (reported by Codacy) Module name "20241220-145409_0b72e62efd44_add_partner_column_in_the_proposal_" doesn't conform to snake_case naming style Warning
Module name "20241220-145409_0b72e62efd44_add_partner_column_in_the_proposal_" doesn't conform to snake_case naming style
|
||
|
||
Revision ID: 0b72e62efd44 | ||
Revises: b68482e38606 | ||
Create Date: 2024-12-20 14:54:09.851011 | ||
|
||
""" | ||
from alembic import op | ||
Check warning Code scanning / Pylint (reported by Codacy) No name 'op' in module 'alembic' Warning
No name 'op' in module 'alembic'
|
||
import sqlalchemy as sa | ||
Check warning Code scanning / Prospector (reported by Codacy) Unable to import 'sqlalchemy' (import-error) Warning
Unable to import 'sqlalchemy' (import-error)
Check warning Code scanning / Pylintpython3 (reported by Codacy) third party import "import sqlalchemy as sa" should be placed before "from alembic import op" Warning
third party import "import sqlalchemy as sa" should be placed before "from alembic import op"
|
||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '0b72e62efd44' | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "revision" doesn't conform to UPPER_CASE naming style Warning
Constant name "revision" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "revision" doesn't conform to UPPER_CASE naming style Warning
Constant name "revision" doesn't conform to UPPER_CASE naming style
|
||
down_revision = 'b68482e38606' | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "down_revision" doesn't conform to UPPER_CASE naming style Warning
Constant name "down_revision" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "down_revision" doesn't conform to UPPER_CASE naming style Warning
Constant name "down_revision" doesn't conform to UPPER_CASE naming style
|
||
branch_labels = None | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "branch_labels" doesn't conform to UPPER_CASE naming style Warning
Constant name "branch_labels" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "branch_labels" doesn't conform to UPPER_CASE naming style Warning
Constant name "branch_labels" doesn't conform to UPPER_CASE naming style
|
||
depends_on = None | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "depends_on" doesn't conform to UPPER_CASE naming style Warning
Constant name "depends_on" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "depends_on" doesn't conform to UPPER_CASE naming style Warning
Constant name "depends_on" doesn't conform to UPPER_CASE naming style
|
||
|
||
|
||
def upgrade(): | ||
Check warning Code scanning / Pylint (reported by Codacy) Missing function docstring Warning
Missing function docstring
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing function or method docstring Warning
Missing function or method docstring
|
||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('partner', | ||
sa.Column('partner_id', sa.Integer(), autoincrement=False, nullable=False, comment='Unique identifier of the partner'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
Check warning Code scanning / Pylint (reported by Codacy) Line too long (123/100) Warning
Line too long (123/100)
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Line too long (123/100) Warning
Line too long (123/100)
|
||
sa.Column('partner_name', sa.String(), nullable=False, comment='Name of the partner (e.g., subaru, gemini, keck, and uh)'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
Check warning Code scanning / Pylint (reported by Codacy) Line too long (127/100) Warning
Line too long (127/100)
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Line too long (127/100) Warning
Line too long (127/100)
|
||
sa.Column('partner_description', sa.String(), nullable=True, comment='Description of the partner'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Line too long (103/100) Warning
Line too long (103/100)
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Line too long (103/100) Warning
Line too long (103/100)
|
||
sa.Column('created_at', sa.DateTime(), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True, comment='The date and time in UTC when the record was created'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Line too long (184/100) Warning
Line too long (184/100)
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
|
||
Check warning Code scanning / Prospector (reported by Codacy) line too long (184 > 159 characters) (E501) Warning
line too long (184 > 159 characters) (E501)
Check warning Code scanning / Pylintpython3 (reported by Codacy) Line too long (184/100) Warning
Line too long (184/100)
|
||
sa.Column('updated_at', sa.DateTime(), nullable=True, comment='The date and time in UTC when the record was last updated'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
Check warning Code scanning / Pylint (reported by Codacy) Line too long (127/100) Warning
Line too long (127/100)
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Line too long (127/100) Warning
Line too long (127/100)
|
||
sa.PrimaryKeyConstraint('partner_id'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
|
||
sa.UniqueConstraint('partner_id'), | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
|
||
sa.UniqueConstraint('partner_name') | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 16 spaces). Warning
Wrong continued indentation (add 16 spaces).
|
||
) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (add 15 spaces). Warning
Wrong continued indentation (add 15 spaces).
|
||
op.add_column('proposal', sa.Column('partner_id', sa.Integer(), nullable=True)) | ||
op.create_foreign_key(None, 'proposal', 'partner', ['partner_id'], ['partner_id']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
Check warning Code scanning / Pylint (reported by Codacy) Missing function docstring Warning
Missing function docstring
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing function or method docstring Warning
Missing function or method docstring
|
||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, 'proposal', type_='foreignkey') | ||
op.drop_column('proposal', 'partner_id') | ||
op.drop_table('partner') | ||
# ### end Alembic commands ### |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# `partner` | ||
|
||
## Overview | ||
|
||
The `partner` table is used to store the information on partner institutions. | ||
|
||
## Columns | ||
|
||
Here are the columns in the `partner` table: | ||
|
||
| Column Name | Type | Description | Required[^1] | Default | | ||
|
||
| ------------------- | -------- | ---------------------------------------------------------- | ------------ | ------- | | ||
| partner_id | int | The unique identifier of the partner | \* | | | ||
| partner_name | str | The name of the partner | \* | | | ||
| partner_description | str | A brief description of the partner | | "" | | ||
| created_at | datetime | The date and time in UTC when the record was created. | | | | ||
| updated_at | datetime | The date and time in UTC when the record was last updated. | | | | ||
|
||
[^1]: Required when inserted by using the [CLI tool](../reference/cli.md) or equivalent functions. | ||
Check notice Code scanning / Remark-lint (reported by Codacy) Warn when references to undefined definitions are found. Note documentation
[no-undefined-references] Found reference to undefined definition
Check notice Code scanning / Remark-lint (reported by Codacy) Warn when shortcut reference links are used. Note documentation
[no-shortcut-reference-link] Use the trailing [] on reference links
|
||
|
||
## Unique constraint | ||
|
||
- `partner_id` is the primary key of the table and must be unique. However, it not set as an auto-increment column. | ||
|
||
## Available proposal categories | ||
|
||
| partner_id | partner_name | partner_description | | ||
| ---------: | ------------ | ---------------------- | | ||
| 1 | subaru | Subaru Telescope | | ||
| 2 | keck | W. M. Keck Observatory | | ||
| 3 | gemini | Gemini Observatory | | ||
| 4 | uh | University of Hawaii | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# public.partner | ||
|
||
## Description | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| partner_id | integer | | false | | | Unique identifier of the partner | | ||
| partner_name | varchar | | false | | | Name of the partner (e.g., subaru, gemini, keck, and uh) | | ||
| partner_description | varchar | | true | | | Description of the partner | | ||
| created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | | ||
| updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| partner_pkey | PRIMARY KEY | PRIMARY KEY (partner_id) | | ||
| partner_partner_name_key | UNIQUE | UNIQUE (partner_name) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| partner_pkey | CREATE UNIQUE INDEX partner_pkey ON public.partner USING btree (partner_id) | | ||
| partner_partner_name_key | CREATE UNIQUE INDEX partner_partner_name_key ON public.partner USING btree (partner_name) | | ||
|
||
## Relations | ||
|
||
```mermaid | ||
erDiagram | ||
|
||
|
||
"public.partner" { | ||
integer partner_id | ||
varchar partner_name | ||
varchar partner_description | ||
timestamp_without_time_zone created_at | ||
timestamp_without_time_zone updated_at | ||
} | ||
``` | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
partner_id,partner_name,partner_description | ||
1,subaru,Subaru Telescope | ||
2,keck,"W. M. Keck Observatory" | ||
3,gemini,Gemini Telescope | ||
4,uh,University of Hawaii |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
proposal_category_id,proposal_category_name,proposal_category_description | ||
1,openuse,Subaru openuse proposal | ||
2,keck,Subaru/Keck time exchange proposal | ||
3,gemini,Subaru/Gemini time exchange proposal | ||
4,uh,University of Hawaii proposal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python | ||
Check warning Code scanning / Pylint (reported by Codacy) Missing module docstring Warning
Missing module docstring
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing module docstring Warning
Missing module docstring
|
||
|
||
from sqlalchemy import ( | ||
Check warning Code scanning / Prospector (reported by Codacy) Unable to import 'sqlalchemy' (import-error) Warning
Unable to import 'sqlalchemy' (import-error)
|
||
Column, | ||
DateTime, | ||
Integer, | ||
String, | ||
) | ||
from sqlalchemy.orm import relationship | ||
Check warning Code scanning / Prospector (reported by Codacy) Unable to import 'sqlalchemy.orm' (import-error) Warning
Unable to import 'sqlalchemy.orm' (import-error)
|
||
|
||
from . import Base, comment_created_at, comment_updated_at, utcnow | ||
|
||
|
||
class partner(Base): | ||
Check warning Code scanning / Pylint (reported by Codacy) Missing class docstring Warning
Missing class docstring
Check warning Code scanning / Pylint (reported by Codacy) Class name "partner" doesn't conform to PascalCase naming style Warning
Class name "partner" doesn't conform to PascalCase naming style
Check warning Code scanning / Pylint (reported by Codacy) Too few public methods (0/2) Warning
Too few public methods (0/2)
|
||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Class name "partner" doesn't conform to PascalCase naming style Warning
Class name "partner" doesn't conform to PascalCase naming style
Check warning Code scanning / Pylintpython3 (reported by Codacy) Too few public methods (0/2) Warning
Too few public methods (0/2)
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing class docstring Warning
Missing class docstring
|
||
__tablename__ = "partner" | ||
|
||
partner_id = Column( | ||
Integer, | ||
primary_key=True, | ||
unique=True, | ||
autoincrement=False, | ||
comment="Unique identifier of the partner", | ||
) | ||
partner_name = Column( | ||
String, | ||
unique=True, | ||
nullable=False, | ||
comment="Name of the partner (e.g., subaru, gemini, keck, and uh)", | ||
) | ||
partner_description = Column( | ||
String, default="", comment="Description of the partner" | ||
) | ||
created_at = Column( | ||
DateTime, | ||
comment=comment_created_at, | ||
server_default=utcnow(), | ||
) | ||
updated_at = Column( | ||
DateTime, | ||
comment=comment_updated_at, | ||
onupdate=utcnow(), | ||
) | ||
|
||
proposals = relationship("proposal", backref="partner") |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Module name "20241220-145409_0b72e62efd44_add_partner_column_in_the_proposal_" doesn't conform to snake_case naming style Warning