Skip to content

Commit

Permalink
Merge pull request #42 from submarcos/psycopg3
Browse files Browse the repository at this point in the history
Support psycopg3
  • Loading branch information
submarcos committed Jul 27, 2023
2 parents 78d3c40 + d2641eb commit c49c0c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
matrix:
python-version: ['3.7', '3.8', '3.11']
django-version: ['3.2.*', '4.2.*']
psycopg: ['psycopg2-binary']
postgis-image: ['postgis/postgis:10-2.5', 'postgis/postgis:11-2.5', 'postgis/postgis:latest']
exclude:
- postgis-image: 'postgis/postgis:11-2.5'
Expand All @@ -25,6 +26,11 @@ jobs:
django-version: '4.2.*' # Django 4.2 supports only postgres >= 12
- postgis-image: 'postgis/postgis:11-2.5'
django-version: '4.2.*' # Django 4.2 supports only postgres >= 12
include:
- postgis-image: 'postgis/postgis:latest'
django-version: '4.2.*'
python-version: '3.11'
psycopg: ['psycopg-binary']

services:
postgres:
Expand All @@ -51,13 +57,21 @@ jobs:
else
pip install Django==${{ matrix.django-version }} -U;
fi
if [[ ${{ matrix.psycopg }} == psycopg-binary ]]; then
pip uninstall psycopg2-binary;
else
pip install psycopg2-binary -U;
fi
- name: Run migrations
run: |
python3 ./manage.py makemigrations --check
python3 ./manage.py migrate
- name: Test with coverage
run: |
coverage run ./manage.py test
- name: Coverage upload
run: |
pip install codecov
Expand Down
3 changes: 2 additions & 1 deletion vectortiles/postgis/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ def get_tile(self, x, y, z):
],
)
row = cursor.fetchone()[0]
return row.tobytes() if row else b""
# psycopg2 returns memoryview, psycopg returns bytes
return row.tobytes() if type(row) == memoryview else row or b""

0 comments on commit c49c0c8

Please sign in to comment.