Skip to main content

A Database Query Language (Django gateway)

Project description

HTSQL is a comprehensive navigational query language for relational databases. This package contains a Django application that provides a gateway to HTSQL service.

This is an experimental package. The usage, API, and security assumptions may change in future releases.

For more information on HTSQL, please see:

http://htsql.org/

The HTSQL homepage

http://pypi.python.org/pypi/HTSQL/

The source package for HTSQL

Installation and Usage

This package allows you to use HTSQL in your Django projects. To install it, run:

# pip install HTSQL-DJANGO

This command installs HTSQL itself and a Django gateway. Out of the box, HTSQL works with SQLite databases. To run HTSQL on top of other database servers, install additional database backends:

# pip install HTSQL-PGSQL
# pip install HTSQL-MYSQL

To use HTSQL in your Django project, open settings.py and add 'htsql_django' to the list of installed applications:

INSTALLED_APPS = (
    # ...
    'htsql_django',
)

When used in a Django project, HTSQL service is automatically configured to serve on the default Django database. You could provide additional configuration options using parameter HTSQL_CONFIG. For instance, a reasonable configuration could be:

HTSQL_CONFIG = {
    # Set query timeout in seconds (currently, PostgreSQL only).
    'tweak.timeout': { 'timeout': 600 },
    # Set the maximum number of output rows.
    'tweak.autolimit': { 'limit': 10000 },
    # Enable the web-based query editor.
    'tweak.shell.default': {},
    # Enable meta-data queries.
    'tweak.meta': {},
}

Next, add the gateway to the URL dispatcher. Open urls.py and add the following line:

urlpatterns = patterns('',
    # ...
    url(r'^htsql/', include('htsql_django.urls')),
)

This will forward HTTP requests starting from /htsql/ to the HTSQL service. The gateway is available only to authenticated users.

You could also make HTSQL queries from Python code. For example, to calculate the total number of votes per poll in the Django tutorial project, run:

>>> from htsql_django import produce
>>>
>>> query = "/polls_poll{question, total:=sum(polls_choice.votes)}"
>>> for row in produce(query):
...     print "%s: %s" % (row.question, row.total)
...
What's up?: 6

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

HTSQL-DJANGO-2.3.2.zip (15.7 kB view details)

Uploaded Source

HTSQL-DJANGO-2.3.2.tar.gz (10.0 kB view details)

Uploaded Source

File details

Details for the file HTSQL-DJANGO-2.3.2.zip.

File metadata

  • Download URL: HTSQL-DJANGO-2.3.2.zip
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for HTSQL-DJANGO-2.3.2.zip
Algorithm Hash digest
SHA256 85e95bd03fda72d71c07a3c8d3a7242e2385ed9543bfd5304b5e933d0b18cc15
MD5 6731d1984e411d1daa94058fe6fcc0a0
BLAKE2b-256 53080fa7e1e61d7ad9e15c45badef8eaa3a003e0f93ff5eb6ca0d06caad43de2

See more details on using hashes here.

File details

Details for the file HTSQL-DJANGO-2.3.2.tar.gz.

File metadata

File hashes

Hashes for HTSQL-DJANGO-2.3.2.tar.gz
Algorithm Hash digest
SHA256 00f5f3ca361ec05066ffbb28a1a91a30d2c8f642f617e4c3ad0350faafcfa6ca
MD5 f2a34bab3463e1f999bae043646a21b5
BLAKE2b-256 6a2f1b263fbb89a67ff3fd1c14a6aff468c07b08519ff166d06f9638021b4bfa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page