- build on top of PyHDB
- original work done by @kapilratnani (https://github.com/kapilratnani/django_hana)
-
Install PyHDB
-
Install the python package via setup.py
python setup.py install
-
The config in the Django project is as follows
DATABASES = { 'default': { 'ENGINE': 'django_hana', # or as per your python path 'NAME': '<SCHEMA_NAME>', # The schema to use. It will be created if doesn't exist 'USER': '<USERNAME>', 'PASSWORD': '<PASSWORD>', 'HOST': '<HOSTNAME>', 'PORT': '3<INSTANCE_NUMBER>15', } }
-
HANA doesn't support Timezone. Set USE_TZ=False in settings.py.
Use the column/row-store class decorators to make sure that your models are using the correct HANA engine. If the models are not using any decorators the default behaviour will be a ROW-store column.
from django.db import models
from django_hana import column_store, row_store
@column_store
class ColumnStoreModel(models.Model):
some_field = models.CharField()
@row_store
class RowStoreModel(models.Model):
some_field = models.CharField()
Add django.contrib.gis
to your INSTALLED_APPS
.
In your models.py
files use
from django.contrib.gis.db.models import ...
instead of
from django.db.models import ...
Make use of the following fields:
- PointField
- LineStringField
- PolygonField
- MultiPointField
- MulitLineString
- MultiPolygon
- Fork repo
- Create your feature branch (e.g.
git checkout -b my-new-feature
) - Implement your feature
- Commit your changes (e.g.
git commit -am 'Add some feature'
| See here) - Push to the branch (e.g.
git push -u origin my-new-feature
) - Create new pull request
- (Optional) Create virtualenv
- Install development dependencies (
pip install -r requirements-testing.txt
) - Add test case
- Run tests
- For all supported python and django version:
tox
- For a single env:
tox -e <ENVNAME>
(e.g.tox -e py35django110
) - Tests failing?
- Hack, hack, hack
- Run tests again
- Tests should pass
- Run isort (
isort -rc .
ortox -e isort
) - run flake8 (
flake8 .
ortox -e lint
)
This project is not a part of standard SAP HANA delivery, hence SAP support is not responsible for any queries related to this software. All queries/issues should be reported here.