HTSQL

Hyper Text Structured Query Language (HTSQL) is a schema-driven URI-to-SQL query language that takes a request over HTTP, converts it to a SQL query, executes the query against a database, and returns the results in a format best suited for the user agent (CSV, HTML, etc.)[1] The HTSQL language is implemented on "HTSQL servers," which use HTSQL to convert web requests into equivalent SQL, executes requests on a server-side database, and returns results in XML, HTML, CSV, JSON, or YAML formats. The current implementation as of April 2010 uses Python and works with PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server databases.

HTSQL was prototyped and developed by Clark Evans (who proposed YAML in 2001[2]) and implemented by Kirill Simonov,[3] both of Prometheus Research.

Scope

HTSQL's intended audience is business users who are not SQL programmers. It seeks to simplify non-intuitive relational queries, such as aggregates and projections. The goal is not completeness in replicating SQL, but simplicity and intuitiveness. HTSQL allows users who are familiar with the data, but not SQL syntax, to directly access the database without going through an application.[4]

Syntax

HTSQL uses a URI-based query syntax. Queries typically begin with a single table, optionally prefixed by a schema and followed by a filter expression to limit the number of rows that are returned.[5]

Examples

Joins can be made across tables by referencing the column name preceded by the table name. This example requests the title of a degree program from the program table and the school name from the school table:

/program{school.name, title}

The result of this query from the HTSQL command-line system is:

program
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
school.name               | title
--------------------------+-----------------------------------
School of Art and Design  | Post Baccalaureate in Art History
School of Art and Design  | Bachelor of Arts in Art History
School of Art and Design  | Bachelor of Arts in Studio Art
School of Business        | Graduate Certificate in Accounting

...

Aggregate expressions can be used when there are many-to-one relationships in the database.

/school{name, count(program), count(department)}

The result shows the count (number) of programs and departments in each school:

school
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name                     | count(program) | count(department)
-------------------------+----------------+------------------
School of Art and Design | 3              | 2
School of Business       | 5              | 3
College of Education     | 7              | 2
School of Engineering    | 8              | 4

Applications

HTSQL can be used for ad hoc database queries. Its developers consider it to be more concise and intuitive and therefore less error-prone than SQL for non-technical users.[5]

HTSQL can also be used by "accidental programmers", such as data analysts and UI developers. Besides more readable, HTTP-based queries, HTSQL's developers claim it helps avoid common SQL mistakes like accidental joins.[6]

Versions and licensing

HTSQL follows a dual license model. The software may be used free of charge with open source relational databases, including MySQL and PostgreSQL.[7] Source code is available on the bitbucket site.[8]

A commercial version of HTSQL, compatible with commercial databases like Oracle and Microsoft SQL Server, is also available.[1]

Similar initiatives

References

  1. ^ a b "Home". htsql.org.
  2. ^ YAML
  3. ^ "Hyper text structured query language". Retrieved 4 May 2023.
  4. ^ "Introduction — HTSQL -- HyperText Structured Query Language v1.0 documentation". www.htsql.org. Archived from the original on 11 July 2010.
  5. ^ a b "HTSQL Manual: HyperText Structured Query Language". clarkevans.com. Archived from the original on 8 July 2011.
  6. ^ "HTSQL -- a Query Language for Accidental Programmers".
  7. ^ "HTSQL Permissive License". htsql.org. Retrieved 4 May 2023.
  8. ^ "prometheus / htsql / source — bitbucket.org". bitbucket.org. Archived from the original on 26 September 2010.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.