Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
venv

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <http://keepachangelog.com/en/1.0.0/>`_, and this project adheres to `Semantic Versioning <http://semver.org/spec/v2.0.0.html>`_.

Version 0.6.2
------------------

Released on September 13th 2024

Added
-----
- Geometry field in sqlalchemy

Version 0.6.1.dev0
------------------
Expand Down
2 changes: 1 addition & 1 deletion dbcut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

from .compiler import * # noqa

__version__ = "0.6.1.dev0"
__version__ = "0.6.2"
VERSION = __version__
SQLALCHEMY_VERSION = sqlalchemy.__version__
10 changes: 8 additions & 2 deletions dbcut/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from contextlib import contextmanager

import sqlalchemy
from geoalchemy2 import Geometry
from sqlalchemy import MetaData, Table, create_engine, event, func, inspect
from sqlalchemy.engine.url import make_url
from sqlalchemy.ext.automap import automap_base, generate_relationship
Expand All @@ -21,8 +22,13 @@
from .models import BaseDeclarativeMeta, BaseModel
from .query import BaseQuery, QueryProperty
from .session import SessionProperty
from .utils import (aslist, cached_property, create_directory,
generate_valid_index_name, to_unicode)
from .utils import (
aslist,
cached_property,
create_directory,
generate_valid_index_name,
to_unicode,
)

try:
from easy_profile import SessionProfiler, StreamReporter
Expand Down
4 changes: 4 additions & 0 deletions dbcut/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from io import open

import yaml
from geoalchemy2 import WKBElement
from geoalchemy2.shape import to_shape
from sqlalchemy.orm import Query

from .utils import to_unicode
Expand Down Expand Up @@ -49,6 +51,8 @@ def default(self, obj):
pass
elif hasattr(obj, "__iter__"):
return list(item for item in obj)
elif isinstance(obj, WKBElement):
return str(to_shape(obj))
return super(JSONEncoder, self).default(obj)

return JSONEncoder
Expand Down
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Click
SQLAlchemy
sqlalchemy<2.0
mlalchemy
geoalchemy2
shapely
pptree
python-dotenv
tabulate
Expand Down
13 changes: 10 additions & 3 deletions scripts/run-test-with-docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env bash
ROOT_PROJECT="$(dirname "$(dirname "${BASH_SOURCE[0]}")")"

if ! command -v "docker-compose" >/dev/null
then
compose="docker compose"
else
compose="docker-compose"
fi


export PYTHON_IMAGE=${PYTHON_IMAGE:-python:3.6}
export POSTGRES_IMAGE=${POSTGRES_IMAGE:-postgres:9.6}
Expand Down Expand Up @@ -34,7 +41,7 @@ _print() { printf "\033[1;32m%b\033[0m\n" "$1"; }

_cleanup() {
_print ":: Cleanup"
docker-compose down -v --remove-orphans
$compose down -v --remove-orphans
}

if [ "$1" = "cleanup" ]; then
Expand All @@ -46,8 +53,8 @@ else
_cleanup

_print ":: Building image"
docker-compose build
$compose build

_print ":: Running tests"
docker-compose run --rm app make test
$compose run --rm app make test
fi