Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/test-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install the package on a regular schedule to check if there are any depenedency issues.

name: Test Astrodbkit Dependencies

on:
schedule:
- cron: '0 16 * * *'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12, 3.13]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# install package and requirements
pip install ".[all]"
- name: Test with pytest
run: |
pytest
Comment on lines +28 to +30
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLAlchemy 2.0.38 didn't fail the install, it only failed when using the package so I've included a call to pytest.

16 changes: 13 additions & 3 deletions astrodbkit/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,24 @@ def view_doesnt_exist(ddl, target, connection, **kw):


def view(name, metadata, selectable):
t = table(name)

t._columns._populate_separate_keys(col._make_proxy(t) for col in selectable.selected_columns)
t = sa.table(
name,
*(
sa.Column(c.name, c.type, primary_key=c.primary_key)
for c in selectable.selected_columns
),
)
t.primary_key.update(c for c in t.c if c.primary_key)

sa.event.listen(
metadata,
"after_create",
CreateView(name, selectable).execute_if(callable_=view_doesnt_exist),
)
sa.event.listen(metadata, "before_drop", DropView(name).execute_if(callable_=view_exists))
sa.event.listen(
metadata,
"before_drop",
DropView(name).execute_if(callable_=view_exists),
)
return t
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ requires-python = ">= 3.11"
dependencies = [
"astropy",
"astroquery",
"sqlalchemy>=2.0",
"sqlalchemy>=2.0.38",
"pandas>=1.0.4",
"packaging",
"specutils>=1.0",
Expand Down