Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

The chain of tools, that to make work with SQL easier

Project Description

The chain of tools that make work with SQL procedures easier.

Syntax

  • #include “<filename>” - include the specified filename, the absolute and relative urls supported.
  • #define name <value> - specify the value, that can be used as $name
  • #define name(arg1, …, argN) - the function, that can be used as $name(a1,…aN)
  • #undef name - undefine previously defined instruction
  • #if condition expression else alternative - conditional expressions
  • SELECT … ; – > array - hint, that informs about query returns more that one element
  • SELECT … ; – > object - hint, that informs about query returns exactly one element
  • COMMENT “returns union” - hint, to merge all objects from results sets to one
  • COMMENT “<table name> (<colum name column type>,…);” - hint, that allow to pass the list of arguments to procedure via temporary table

wsql-trans:

The extensions above native SQL.

supports:

  • macros
#define table_name "mytable"
select * from $table_name;
  • macro-functions
#define quote(a) "a"
select upper(quote(a));
  • conditions
#define a 1
#if a == 1
select * from t1;
#else
select * from t2;
#endif
  • includes
#include "common.sql"

wsql-codegen:

Generate the native code to work with SQL procedures. Now supports python3 native and aio. The C++ under development. Required WSQL.

Hints

  • SELECT … ; – > array - hint, that informs about query returns more that one element
  • SELECT … ; – > object - hint, that informs about query returns exactly one element
  • COMMENT “returns union” - hint, to merge all objects from results sets to one
  • COMMENT “<table name> (<colum name column type>,…);” - hint, that allow to pass the list of arguments to procedure via temporary table

SQL

CREATE PROCEDURE table1.insert (value VARCHAR(10))
BEGIN
    INSERT INTO table1 (value) VALUES(value);
    SELECT LAST_INSERT_ID() AS id;
END

Python3

@coroutine
def insert(connection, value=None):
    """
    insert, table1
    :param value: the value(VARCHAR(10), IN))
    :return (id,)
    """
    @coroutine
    def __query(__connection):
        __cursor = __connection.cursor()
        try:
            yield from __cursor.callproc(b"procedure4", (value,))
            return (yield from __cursor.fetchall())[0]
        finally:
            yield from __cursor.close()
    try:
        return (yield from connection.execute(__query))
    except Error as e:
        raise handle_error(exceptions, e)
Release History

Release History

This version
History Node

0.3.17

History Node

0.3.16

History Node

0.3.15

History Node

0.3.14

History Node

0.3.13

History Node

0.3.12

History Node

0.3.11

History Node

0.3.10

History Node

0.3.9

History Node

0.3.8

History Node

0.3.7

History Node

0.3.6

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.2.4

History Node

0.2.2

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
wsql_sdk-0.3.17.tar.gz (633.2 kB) Copy SHA256 Checksum SHA256 Source Mar 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting