Giter VIP home page Giter VIP logo

django_hana's People

Contributors

kapilratnani avatar kasimos avatar lanzz avatar m3o7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

django_hana's Issues

Transaction commit maually

Transaction do not roll back when issuing a save or update when using the django decorator @transaction.commit_manually(using="db") pretty sure it jus stays in auto commit mode.

@kapilratnani

Cannot find engine

I've configured the settings.py as indicated and it looks like it's not recognizing the engine. I've tried also with django.db.backends.django_hana with the same results. Any hints?

'data_source': {
'ENGINE':'django_hana',
'NAME': 'IOT',
'USER': 'ALEX',
'PASSWORD': 'PASSWORD',
'HOST': '186.47.255.17',
'PORT': '30015',
}

I'm getting the error:
Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x7f296919b320>
Traceback (most recent call last):
File "/home/django/Env/product/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(_args, *_kwargs)
File "/home/django/Env/product/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/home/django/Env/product/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/django/Env/product/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/django/Env/product/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 28, in check_all_models
errors.extend(model.check(**kwargs))
File "/home/django/Env/product/lib/python2.7/site-packages/django/db/models/base.py", line 1172, in check
errors.extend(cls._check_long_column_names())
File "/home/django/Env/product/lib/python2.7/site-packages/django/db/models/base.py", line 1587, in _check_long_column_names
connection = connections[db]
File "/home/django/Env/product/lib/python2.7/site-packages/django/db/utils.py", line 212, in getitem
backend = load_backend(db['ENGINE'])
File "/home/django/Env/product/lib/python2.7/site-packages/django/db/utils.py", line 135, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django_hana' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql', 'sqlite3'
Error was: cannot import name BaseDatabaseOperations
^C(product) django@ip-172-31-63-203:/product>
(product) django@ip-172-31-63-203:
/product> python
Python 2.7.9 (default, Dec 13 2014, 18:02:08) [GCC] on linux2
.

ModelForms always rendering Enabled Checkbox for Boolean fields, even when value is 0

The problem is that in newer vesions of Django ModelForms fail to work with 0/1 as the BooleanField values. The admin, for example, always renders enabled checkboxes for BooleanFields, even when the value is 0.

Other backends have shown the same problems, see https://code.djangoproject.com/ticket/15169

The fix is to convert 0/1 to True/False in the backend. I ported the gis.mysql fix to Hana, pull request incoming.

Update/insert/read -10413, Illegal TIMESTAMP value

Environment:

Request Method: POST
Request URL: http://10.48.171.221:8000/admin/

Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
('django_extensions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'haystack',
'webapp')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in wrapper
  2.             return self.admin_view(view, cacheable)(_args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  3.                 response = view_func(request, _args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  4.     response = view_func(request, _args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner
  5.         if not self.has_permission(request):
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in has_permission
  6.     return request.user.is_active and request.user.is_staff
    
    File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in inner
  7.         self._setup()
    
    File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in _setup
  8.     self._wrapped = self._setupfunc()
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/middleware.py" in
  9.     request.user = SimpleLazyObject(lambda: get_user(request))
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/middleware.py" in get_user
  10.     request._cached_user = auth.get_user(request)
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/init.py" in get_user
  11.     user_id = request.session[SESSION_KEY]
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py" in getitem
  12.     return self._session[key]
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py" in _get_session
  13.             self._session_cache = self.load()
    
    File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py" in load
  14.             expire_date__gt=timezone.now()
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in get
  15.     return self.get_query_set().get(_args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
  16.     num = len(clone)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in len
  17.             self._result_cache = list(self.iterator())
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in iterator
  18.     for row in compiler.results_iter():
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/compiler.py" in results_iter
  19.     for rows in self.execute_sql(MULTI):
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/compiler.py" in execute_sql
  20.     cursor.execute(sql, params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  21.         return CursorWrapper.execute(self,sql, params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  22.     self.cursor.execute(self._replace_params(sql,len(params) if params else 0),params)
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in execute
  23.         ret = self.__execute(operation, parameters)
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in __execute
  24.     ret = self.__cursor.execute(operation, parameters=parameters, iscall=iscall)
    

Exception Type: Error at /admin/
Exception Value: (-10413, 'Illegal TIMESTAMP value for parameter/column (2)')

syncdb on existing tables

Hi there, we were on another computer and we were trying to sync to a remote amazon ec2 DB but it seems that the syncdb script tries to create the tables even if they exist. Is this something we are missing here?

ubuntu:/sc/StudentCloud$ sudo python manage.py syncdb -v 3

Creating tables ...
Processing auth.Permission model
Creating table auth_permission
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/init.py", line 443, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/init.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
output = self.handle(_args, *_options)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 102, in handle_noargs
cursor.execute(statement)
File "/usr/local/lib/python2.7/dist-packages/django_hana/base.py", line 95, in execute
return CursorWrapper.execute(self,sql, params)
File "/usr/local/lib/python2.7/dist-packages/django_hana/base.py", line 75, in execute
self.cursor.execute(self._replace_params(sql,len(params) if params else 0),params)
File "/usr/lib/python2.7/dist-packages/hdbcli/dbapi.py", line 363, in execute
ret = self.__execute(operation, parameters)
File "/usr/lib/python2.7/dist-packages/hdbcli/dbapi.py", line 244, in __execute
ret = self.__cursor.execute(operation, parameters=parameters, iscall=iscall)
hdbcli.dbapi.Error: (288, 'cannot use duplicate table name: AUTH_PERMISSION: line 1 col 18 (at pos 17)')

SYNCDB

Running ./manage.py dbshell gives "Error: You appear not to have the 'hdbsql' program installed or on your path." So I am not sure of a good way to alter tables.

Adding a question

Environment:
Request Method: GET
Request URL: http://10.48.171.221:8000/question

Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
('django_extensions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'haystack',
'webapp')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/decorators.py" in _decorated
  2.           return the_func(_args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  3.     response = view_func(request, _args, *_kwargs)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/views.py" in call
  4.         return self.read_all(request)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/views.py" in read_all
  5.         'related_tags' : [t.as_dict() for t in related_tags],
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in iter
  6.     query = iter(self.query)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py" in iter
  7.     self._execute_query()
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py" in _execute_query
  8.     self.cursor.execute(self.sql, self.params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  9.         return CursorWrapper.execute(self,sql, params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  10.     self.cursor.execute(self._replace_params(sql,len(params) if params else 0),params)
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in execute
  11.         ret = self.__execute(operation, parameters)
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in __execute
  12.     ret = self.__cursor.execute(operation, parameters=parameters, iscall=iscall)
    

Exception Type: Error at /question
Exception Value: (277, 'not a GROUP BY expression: T.*: line 2 col 24 (at pos 24)')

SELECT DISTINCT NOT WORKING

Running a distinct query does not work if I run the following django it will produce the following sql

Django:

OrgBuilder.objects.order_by('Eff_Date').distinct('Eff_Date')

The sql will produce:

SELECT DISTINCT (OrgBuilder_orgbuilder.Eff_Date) OrgBuilder_orgbuilder.id, OrgBuilder_orgbuilder.Eff_Date, OrgBuilder_orgbuilder.instID, OrgBuilder_orgbuilder.Valid_From, OrgBuilder_orgbuilder.Valid_To, OrgBuilder_orgbuilder.Enable, OrgBuilder_orgbuilder.UserID_id FROM OrgBuilder_orgbuilder ORDER BY OrgBuilder_orgbuilder.Eff_Date ASC

that generates the following error:

Error: (257, 'sql syntax error: incorrect syntax near ".": line 1 col 50 (at pos 50)')

The sql it should produces should be like the following:

SELECT DISTINCT OrgBuilder_orgbuilder.Eff_Date FROM studentcloud_developer.OrgBuilder_orgbuilder ORDER BY OrgBuilder_orgbuilder.Eff_Date ASC

@kapilratnani

icontains search not working

Institution.objects.using(db(request)).filter(Description_Short__icontains= "Short")

The following query below creates a sql similar to above

SELECT FoundationBuilder_institution.id, FoundationBuilder_institution.InstID, FoundationBuilder_institution.UserID, FoundationBuilder_institution.Eff_Date, FoundationBuilder_institution.Address, FoundationBuilder_institution.Description_Short, FoundationBuilder_institution.Description_Long, FoundationBuilder_institution.Phone_Number, FoundationBuilder_institution.Fax_Number, FoundationBuilder_institution.Audit, FoundationBuilder_institution.Created FROM FoundationBuilder_institution WHERE FoundationBuilder_institution.Description_Short LIKE UPPER(%Short%) LIMIT 21

However, the type of query it should create should have the column wrapped in upper also like so. If not the query wont return anything

SELECT * FROM "STUDENTCLOUD"."FOUNDATIONBUILDER_INSTITUTION"
WHERE UPPER(Description_Short) LIKE UPPER('%short%') LIMIT 21

Save Error

"Attempting to post a new question and encountered this error... the info did get posted to the table"

Environment:
Request Method: GET
Request URL: http://10.48.171.221:8000/question/1/first-question

Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
('django_extensions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'haystack',
'webapp')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/decorators.py" in _decorated
  2.           return the_func(_args, *_kwargs)
    
    File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  3.     response = view_func(request, _args, *_kwargs)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/views.py" in call
  4.         return self.read(request, id)
    
    File "/home/lroot/sap_hana_answers_server/server/webapp/views.py" in read
  5.     for q in rel_questions:
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in iter
  6.     query = iter(self.query)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py" in iter
  7.     self._execute_query()
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py" in _execute_query
  8.     self.cursor.execute(self.sql, self.params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  9.         return CursorWrapper.execute(self,sql, params)
    
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/hana/base.py" in execute
  10.     self.cursor.execute(self._replace_params(sql,len(params) if params else 0),params)
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in execute
  11.         ret = self.__execute(operation, tuple(parameters))
    
    File "/usr/local/lib/python2.7/dist-packages/hdbcli/dbapi.py" in __execute
  12.     ret = self.__cursor.execute(operation, parameters=parameters, iscall=iscall)
    

Exception Type: Error at /question/1/first-question
Exception Value: (257, 'sql syntax error: incorrect syntax near ",": line 12 col 15 (at pos 457)')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.