diff --git a/.github/workflows/test-dependencies.yml b/.github/workflows/test-dependencies.yml new file mode 100644 index 0000000..9247927 --- /dev/null +++ b/.github/workflows/test-dependencies.yml @@ -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 diff --git a/astrodbkit/views.py b/astrodbkit/views.py index dd8d40e..fb3860e 100644 --- a/astrodbkit/views.py +++ b/astrodbkit/views.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index db24daa..22e696f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",