Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Latest commit

 

History

History
96 lines (78 loc) · 2.98 KB

README.md

File metadata and controls

96 lines (78 loc) · 2.98 KB

Django DB Backend for SAP HANA

Build Status codecov

Installation

  1. Install PyHDB

  2. Install the python package via setup.py

    python setup.py install
  3. 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',
        }
    }
  4. HANA doesn't support Timezone. Set USE_TZ=False in settings.py.

Config

Column/Row store

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()

Support of spatial column types

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

Contributing

  1. Fork repo
  2. Create your feature branch (e.g. git checkout -b my-new-feature)
  3. Implement your feature
  4. Commit your changes (e.g. git commit -am 'Add some feature' | See here)
  5. Push to the branch (e.g. git push -u origin my-new-feature)
  6. Create new pull request

Setting up for developement / Implement a feature

  1. (Optional) Create virtualenv
  2. Install development dependencies (pip install -r requirements-testing.txt)
  3. Add test case
  4. Run tests
  5. For all supported python and django version: tox
  6. For a single env: tox -e <ENVNAME> (e.g. tox -e py35django110)
  7. Tests failing?
  8. Hack, hack, hack
  9. Run tests again
  10. Tests should pass
  11. Run isort (isort -rc . or tox -e isort)
  12. run flake8 (flake8 . or tox -e lint)

Disclaimer

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.