mapzen/py-mapzen-dbtickets

Name: py-mapzen-dbtickets

Owner: Mapzen

Description: Simple Python wrapper for talking to a ticket server.

Created: 2015-07-30 21:02:59.0

Updated: 2016-08-27 17:56:14.0

Pushed: 2015-07-30 21:29:00.0

Homepage: null

Size: 120

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

py-mapzen-dbtickets

Simple Python wrapper for talking to a (MySQL derived) ticket server.

Usage
Simple
ython
import mapzen.dbtickets
s = [{ 'user': 'dbtickets', 'database': 'dbtickets', 'host': 'localhost', 'password': '****'}]
t = mapzen.dbtickets.dbtickets(*hosts)
t.generate_id()

t.generate_id()

t.generate_id()

t.generate_id()

Under the hood py-mapzen-dbtickets uses the mysql.connection library so the arguments you pass in each host config are the same to mysql.connection.

Fancier

Some default values are provided for each host config. They are:

So you might also write something like this:

ython
import mapzen.dbtickets
hosts = [{ 'password': '***'}]
t = mapzen.dbtickets.dbtickets(*hosts)
t.generate_id()

Fiddly

Setting up and configuring the database is outside the scope of this document. The setup assumes that you are able to change the default auto-increment-increment and auto-increment-offset values in MySQL.

If you are not able to you to do this yourself (because you don't have suitable permissions to alter your database or whatever) you can also specify a set_auto_increment flag in your object constructor.

Doing so will tell the library to explicitly set the database's variables using MySQL's built-in SET command. This will incur extra database commands for each connection but the measure of that cost is left up to you.

rt mapzen.dbtickets
s = [{ 'password': '***'}]
mapzen.dbtickets.dbtickets(*hosts, set_auto_increment=True)
t t.generate_id()
Caveats
See also

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.