Welcome to Etcd Database Driver’s documentation!¶
Contents:
Etcd Database Driver¶
PEP 249 compatible driver for Etcd
Features¶
- etcdb python module to query etcd as an SQL database
- Implements basic SQL: DROP/CREATE DATABASE, CREATE TABLE, SELECT, INSERT
- etcdb command line client
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
Stable release¶
To install Etcd Database Driver, run this command in your terminal:
$ pip install etcdb
This is the preferred method to install Etcd Database Driver, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for Etcd Database Driver can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/box/etcdb
Or download the tarball:
$ curl -OL https://github.com/box/etcdb/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
etcdb¶
etcdb package¶
Subpackages¶
etcdb.execute package¶
Subpackages¶
Implement CREATE queries.
-
etcdb.execute.ddl.create.
create_database
(etcd_client, tree)[source]¶ Create database.
Parameters: - etcd_client (Client) – Etcd client
- tree (SQLTree) – Parsing tree
-
etcdb.execute.ddl.create.
create_table
(etcd_client, tree, db=None)[source]¶ Create table.
Parameters: - etcd_client (Client) – Etcd client
- tree (SQLTree) – Parsing tree
- db (str) – Database name to use if not defined in the parsing tree.
Raises: - ProgrammingError – If primary key is not defined, or the primary key is NULL-able.
- OperationalError – if database is not selected or table exists.
Implement DROP queries.
-
etcdb.execute.ddl.drop.
drop_database
(etcd_client, tree)[source]¶ Drop database.
Parameters: - etcd_client (Client) – Etcd client
- tree (SQLTree) – Parsing tree
Raises: OperationalError – if database doesn’t exist
-
etcdb.execute.ddl.drop.
drop_table
(etcd_client, tree, db=None)[source]¶ Drop table.
Parameters: - etcd_client (Client) – Etcd client
- tree (SQLTree) – Parsing tree
- db (str) – Database name to use if not defined in the parsing tree.
Raises: OperationalError – if database is not selected or if table doesn’t exist.
Module with Data Defition Language queries.
-
etcdb.execute.ddl.
database_exists_or_raise
(etcd_client, db)[source]¶ If database db doesn’t exit raise OperationalError.
Parameters: - etcd_client (Client) – Etcd client.
- db (str) – Database name.
Raises: OperationalError – if database doesn’t exist
Implement DELETE query.
Implement INSERT query.
-
etcdb.execute.dml.insert.
get_pk_field
(etcd_client, db, tbl)[source]¶ Get primary key column for table db.tbl.
Parameters: - etcd_client – Etcd client.
- db – database name.
- tbl – table name.
Returns: Primary key column.
Return type:
-
etcdb.execute.dml.insert.
get_table_columns
(etcd_client, db, tbl)[source]¶ Get primary key column for table db.tbl.
Parameters: - etcd_client – Etcd client.
- db – database name.
- tbl – table name.
Returns: Primary key column.
Return type: Raises: ProgrammingError – if table or database doesn’t exist
-
etcdb.execute.dml.insert.
insert
(etcd_client, tree, db)[source]¶ Execute INSERT query
Parameters: - etcd_client (pyetcd.client.Client) – etcd client
- tree (SQLTree) – Parse tree
- db (str) – Current database
Raises: IntegrityError – if duplicate primary key
Implement SELECT query.
-
etcdb.execute.dml.select.
eval_row
(table_columns, table_row, tree)[source]¶ Find values of a row. table_columns are fields in the table. The result columns is taken from tree.expressions.
Parameters:
-
etcdb.execute.dml.select.
execute_select
(etcd_client, tree, db)[source]¶ Execute SELECT query.
Parameters: - etcd_client (pyetcd.client.Client) – etcd client.
- db (str) – Current database.
- tree (SQLTree) – Parse tree.
Returns: ResultSet instance.
Return type:
-
etcdb.execute.dml.select.
execute_select_no_table
(tree)[source]¶ Execute SELECT that doesn’t read from a table. SELECT VERSION() or similar.
-
etcdb.execute.dml.select.
execute_select_plain
(etcd_client, tree, db)[source]¶ Execute SELECT that reads rows from table.
-
etcdb.execute.dml.select.
fix_tree_star
(tree, etcd_client, db, tbl)[source]¶ If parsing tree contains [[“*”, null], null] expression it means the query was SELECT * . So, the expressions needs to be replaced with actual field names.
-
etcdb.execute.dml.select.
get_row_by_primary_key
(etcd_client, db, table, primary_key, **kwargs)[source]¶ Read row from etcd by its primary key value.
Parameters: - etcd_client (Client) –
- db –
- table –
- primary_key – Primary key value.
- kwargs – See below.
Returns: Row
Return type: Keyword Arguments: - wait (bool) - If True it will wait for a change in the key.
- wait_index (int) - When waiting you can specify index to
- wait for.
-
etcdb.execute.dml.select.
group_function
(table_columns, table_row, tree)[source]¶ True if resultset should be grouped
Returns: Grouping function or None and its position. Return type: tuple(EtcdbFunction, int)
-
etcdb.execute.dml.select.
group_result_set
(func, result_set, table_row, tree, pos)[source]¶ Apply a group function to result set and return an aggregated row.
Parameters: Returns: Result set with aggregated row.
Return type:
Implement SHOW queries.
-
etcdb.execute.dml.show.
desc_table
(etcd_client, tree, db)[source]¶ Execute DESC table query#
Parameters: - etcd_client (pyetcd.client.Client) – etcd client
- tree (SQLTree) – Parse tree
- db (str) – Current database
Returns: ResultSet instance
Return type:
Implement UPDATE query.
Implement USE query.
-
etcdb.execute.dml.use.
use_database
(etcd_client, tree)[source]¶ Return database name if it exists or raise exception.
Parameters: - etcd_client (pyetcd.client.Client) – etcd client
- tree (SQLTree) – Parsing tree.
Returns: Database name
Raises: OperationalError – if database doesn’t exist.
Implement WAIT query.
Data modification language routines.
-
etcdb.execute.dml.
get_exclusive_lock
(etcd_client, tree, db)[source]¶ Acquire a write lock on a table. The lock may be explicitly given from a parsing tree when UPDATE or INSERT specifies it with the USE LOCK statement.
Parameters: - etcd_client (pyetcd.client.Client) – etcd connection
- tree (SQLTree) – Parsing tree
- db (str) – Database name. It doesn’t necessary come from the parsing tree. That’s why it has to specified.
Returns: Write lock on a table from the parsing tree in the given database db.
Return type:
Module contents¶
etcdb.log package¶
etcdb.sqlparser package¶
Submodules¶
etcdb.sqlparser.etcdb_lexer module¶
etcdb.sqlparser.parser module¶
-
exception
etcdb.sqlparser.parser.
SQLParserError
[source]¶ Bases:
exceptions.Exception
All SQL parsing errors
-
etcdb.sqlparser.parser.
p_boolean_primary_comparison
(p)[source]¶ boolean_primary : boolean_primary comparison_operator predicate
-
etcdb.sqlparser.parser.
p_boolean_primary_is_not_null
(p)[source]¶ boolean_primary : boolean_primary IS NOT NULL
-
etcdb.sqlparser.parser.
p_boolean_primary_is_null
(p)[source]¶ boolean_primary : boolean_primary IS NULL
-
etcdb.sqlparser.parser.
p_column_definition
(p)[source]¶ column_definition : data_type opt_column_def_options_list
-
etcdb.sqlparser.parser.
p_comparison_operator
(p)[source]¶ comparison_operator : ‘=’ | GREATER_OR_EQ | ‘>’ | LESS_OR_EQ | ‘<’ | N_EQ
-
etcdb.sqlparser.parser.
p_create_database_statement
(p)[source]¶ create_database_statement : CREATE DATABASE identifier
-
etcdb.sqlparser.parser.
p_create_definition
(p)[source]¶ create_definition : identifier column_definition
-
etcdb.sqlparser.parser.
p_create_definition_list_many
(p)[source]¶ create_definition_list : create_definition_list ‘,’ create_definition
-
etcdb.sqlparser.parser.
p_create_definition_list_one
(p)[source]¶ create_definition_list : create_definition
-
etcdb.sqlparser.parser.
p_create_table_statement
(p)[source]¶ create_table_statement : CREATE TABLE identifier ‘(‘ create_definition_list ‘)’
-
etcdb.sqlparser.parser.
p_data_type
(p)[source]¶ data_type : INTEGER opt_UNSIGNED | VARCHAR ‘(‘ NUMBER ‘)’ | DATETIME | DATETIME ‘(‘ NUMBER ‘)’ | INT opt_UNSIGNED | LONGTEXT | SMALLINT opt_UNSIGNED | TINYINT | BOOL
-
etcdb.sqlparser.parser.
p_delete_statement
(p)[source]¶ delete_statement : DELETE FROM identifier opt_WHERE
-
etcdb.sqlparser.parser.
p_drop_database_statement
(p)[source]¶ drop_database_statement : DROP DATABASE identifier
-
etcdb.sqlparser.parser.
p_drop_table_statement
(p)[source]¶ drop_table_statement : DROP TABLE identifier opt_IF_EXISTS
-
etcdb.sqlparser.parser.
p_insert_statement
(p)[source]¶ insert_statement : INSERT INTO identifier opt_fieldlist VALUES ‘(‘ values_list ‘)’ opt_USE_LOCK
-
etcdb.sqlparser.parser.
p_opt_ORDER_BY_extended
(p)[source]¶ opt_ORDER_BY : ORDER BY identifier ‘.’ identifier opt_ORDER_DIRECTION
-
etcdb.sqlparser.parser.
p_opt_ORDER_BY_simple
(p)[source]¶ opt_ORDER_BY : ORDER BY identifier opt_ORDER_DIRECTION
-
etcdb.sqlparser.parser.
p_opt_column_def_options_list
(p)[source]¶ opt_column_def_options_list : opt_column_def_options opt_column_def_options_list
-
etcdb.sqlparser.parser.
p_opt_column_def_options_list_empty
(p)[source]¶ opt_column_def_options_list :
-
etcdb.sqlparser.parser.
p_select_item_list
(p)[source]¶ select_item_list : select_item_list ‘,’ select_item
-
etcdb.sqlparser.parser.
p_select_statement
(p)[source]¶ select_statement : SELECT select_item_list opt_FROM opt_WHERE opt_ORDER_BY opt_LIMIT
-
etcdb.sqlparser.parser.
p_set_statement
(p)[source]¶ set_statement : set_autocommit_statement | set_names_statement
-
etcdb.sqlparser.parser.
p_set_statement_autocommit
(p)[source]¶ set_autocommit_statement : SET AUTOCOMMIT ‘=’ NUMBER
-
etcdb.sqlparser.parser.
p_show_databases_statement
(p)[source]¶ show_databases_statement : SHOW DATABASES
-
etcdb.sqlparser.parser.
p_show_tables_statement
(p)[source]¶ show_tables_statement : SHOW opt_FULL TABLES
-
etcdb.sqlparser.parser.
p_simple_expr_identifier_full
(p)[source]¶ simple_expr : identifier ‘.’ identifier
-
etcdb.sqlparser.parser.
p_statement
(p)[source]¶ statement : select_statement | show_tables_statement | create_table_statement | create_database_statement | show_databases_statement | use_database_statement | commit_statement | set_statement | insert_statement | delete_statement | drop_database_statement | drop_table_statement | desc_table_statement | update_table_statement | wait_statement
-
etcdb.sqlparser.parser.
p_table_reference_w_database
(p)[source]¶ table_reference : identifier ‘.’ identifier
etcdb.sqlparser.parsetab module¶
etcdb.sqlparser.sql_tree module¶
Module contents¶
Submodules¶
etcdb.cli module¶
Command line functions
etcdb.connection module¶
Connection class definition
etcdb.cursor module¶
-
class
etcdb.cursor.
Cursor
(connection)[source]¶ Bases:
object
These objects represent a database cursor, which is used to manage the context of a fetch operation. Cursors created from the same connection are not isolated, i.e. , any changes done to the database by a cursor are immediately visible by the other cursors. Cursors created from different connections can or can not be isolated, depending on how the transaction support is implemented (see also the connection’s .rollback () and .commit () methods).
-
arraysize
= 1¶ This read/write attribute specifies the number of rows to fetch at a time with .fetchmany(). It defaults to 1 meaning to fetch a single row at a time.
-
connection
= None¶ Etcd connection object
-
description
= None¶ This read-only attribute is a sequence of 7-item sequences.
Each of these sequences contains information describing one result column:
name type_code display_size internal_size precision scale null_okThe first two items ( name and type_code ) are mandatory, the other five are optional and are set to None if no meaningful values can be provided.
-
execute
(query, args=None)[source]¶ Prepare and execute a database operation (query or command).
Parameters: - query (str) – Query text.
- args (tuple) – Optional query arguments.
Raises: - ProgrammingError – if query can’t be parsed.
- InternalError – If etcd is not ready to serve request
-
static
executemany
(operation, **kwargs)[source]¶ Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters .
-
fetchall
()[source]¶ Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor’s arraysize attribute can affect the performance of this operation.
-
fetchmany
(n)[source]¶ Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available.
-
fetchone
()[source]¶ Fetch the next row of a query result set, returning a single sequence, or None when no more data is available.
-
static
morgify
(query, args)[source]¶ Prepare query string that will be sent to parser
Parameters: - query – Query text
- args – Tuple with query arguments
Returns: Query text
Return type: str
-
n_cols
¶
-
n_rows
¶
-
result_set
¶
-
rowcount
¶
-
etcdb.etcddate module¶
etcdb.etcdstring module¶
etcdb.etcdtime module¶
etcdb.etcdtimestamp module¶
etcdb.eval_expr module¶
Module provides functions to evaluate an expression given in a WHERE statement. Grammar of expression is described on MySQL website (https://dev.mysql.com/doc/refman/5.7/en/expressions.html).
-
class
etcdb.eval_expr.
EtcdbFunction
(*args, **kwargs)[source]¶ Bases:
object
EtcdbFunction represents an SQL function.
Parameters: - function_name (callable) – python function that implements SQL function.
- group (bool) – True if the functions is aggregate function
- args – Arguments to pass to function_name
- kwargs – Keyword arguments
-
function
¶ Return function name
-
group
¶ Return whether the function is aggregate
-
etcdb.eval_expr.
etcdb_count
(result_set)[source]¶ Count rows in result set
Parameters: result_set (ResultSet) – ResultSet instance Returns: number of rows in ResultSet Return type: int
-
etcdb.eval_expr.
eval_expr
(row, tree)[source]¶ Evaluate expression
Returns: Tuple with string representation and value. For example, (‘id’, 5). Return type: tuple
-
etcdb.eval_expr.
eval_function_call
(row, tree)[source]¶ Evaluate function call :return: tuple with field name and EtcdbFunction instance
etcdb.exception module¶
etcdb exceptions
-
exception
etcdb.exception.
DataError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.
-
exception
etcdb.exception.
DatabaseError
[source]¶ Bases:
etcdb.exception.Error
Exception raised for errors that are related to the database.
-
exception
etcdb.exception.
Error
[source]¶ Bases:
exceptions.Exception
Exception that is the base class of all other error exceptions.
-
exception
etcdb.exception.
IntegrityError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.
-
exception
etcdb.exception.
InterfaceError
[source]¶ Bases:
etcdb.exception.Error
Exception raised for errors that are related to the database interface rather than the database itself.
-
exception
etcdb.exception.
InternalError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc.
-
exception
etcdb.exception.
NotSupportedError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised in case a method or database API was used which is not supported by the database, e.g. requesting a .rollback() on a connection that does not support transaction or has transactions turned off.
-
exception
etcdb.exception.
OperationalError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised for errors that are related to the database’s operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
-
exception
etcdb.exception.
ProgrammingError
[source]¶ Bases:
etcdb.exception.DatabaseError
Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc.
etcdb.lock module¶
Locking for etcdb
etcdb implements MyISAM style locking. There is an exclusive writer lock and there are many shared reader locks. A client can acquire a writer lock if there are no readers and no writers. A client can acquire a reader lock if there are no writers.
-
class
etcdb.lock.
Lock
(etcd_client, db, tbl, **kwargs)[source]¶ Bases:
object
Instantiate Lock instance for a table.
Parameters: - etcd_client (Client) – Etcd client
- db – Database name.
- tbl – Table name.
-
acquire
(timeout=50, ttl=50, **kwargs)[source]¶ Get a lock
Parameters: - timeout (int) – Timeout to acquire a lock.
- ttl (int) – Place a lock on this time in seconds. 0 for permanent lock.
- kwargs –
Keyword arguments.
- author (
str
) - Who requests the lock. - By default, ‘etcdb’.
- author (
- reason (
str
) - Human readable reason to get the lock. - By default, ‘etcdb internal operation’.
- reason (
Raises: - InternalError – This class shouldn’t be used directly and if user doesn’t set lock_prefix the method should raise exception.
- OperationalError – If lock wait timeout expires.
Returns: String that identifies who acquired the lock. Return type: str
-
created_at
¶ Returns: When the lock was acquired in Unix timestamp. Return type: int
-
id
¶ Lock identifier
-
readers
()[source]¶ Get list of reader locks.
Returns: List of ReadLock() instances Return type: list(ReadLock)
-
reason
¶ Returns: String that explains why lock was acquired. Return type: str
-
class
etcdb.lock.
MetaLock
(etcd_client, db, tbl)[source]¶ Bases:
etcdb.lock.Lock
Meta lock is needed to place a read or write lock.
-
class
etcdb.lock.
ReadLock
(etcd_client, db, tbl, lock_id=None)[source]¶ Bases:
etcdb.lock.Lock
Read lock.
-
class
etcdb.lock.
WriteLock
(etcd_client, db, tbl, lock_id=None)[source]¶ Bases:
etcdb.lock.Lock
Write lock.
etcdb.resultset module¶
Classes that represent query results
-
class
etcdb.resultset.
Column
(colname, coltype=None, options=None)[source]¶ Bases:
object
Instantiate a Column
Parameters: - colname (str) – Column name.
- coltype (str) – Column type
- options (ColumnOptions) – Column options
-
auto_increment
¶ True if column is auto_incrementing.
-
default
¶ Column default value.
-
name
¶ Column name
-
nullable
¶ True if column is NULL-able.
-
primary
¶ True if column is primary key.
-
print_width
¶ How many symbols client has to spare to print column value. A column name can be short, but its values may be longer. To align column and its values print_width is number of characters a client should allocate for the column name so it will be as lager as the largest columns length value.
-
type
¶ Column type e.g. INT, VARCHAR, etc.
-
unique
¶ True if column is unique key.
-
class
etcdb.resultset.
ColumnOptions
(*options, **kwoptions)[source]¶ Bases:
object
ColumnOptions represents column options like NULL-able or not
-
auto_increment
= False¶
-
default
= None¶
-
nullable
= None¶
-
primary
= False¶
-
unique
= None¶
-
-
class
etcdb.resultset.
ColumnSet
(columns=None)[source]¶ Bases:
object
Instantiate a Column set
Parameters: columns (dict) – Optional dictionary with column definitions -
add
(column)[source]¶ Add column to ColumnSet
Parameters: column (Column) – Column instance Returns: Updated CoulmnSet instance Return type: ColumnSet
-
columns
¶ Returns list of Columns
-
empty
¶ True if there are no columns in the ColumnSet
-
primary
¶ Return primary key column
-
-
class
etcdb.resultset.
ResultSet
(columns, rows=None)[source]¶ Bases:
object
Represents query result
Parameters: -
add_row
(row)[source]¶ Add row to result set
Parameters: row (Row) – Row instance Returns: Updated result set Return type: ResultSet Raises: InternalError – if row is not a Row class instance.
-
n_cols
¶ Return number of columns in the result set.
-
n_rows
¶ Return number of rows in the result set.
-
-
class
etcdb.resultset.
Row
(row, etcd_index=0, modified_index=0)[source]¶ Bases:
object
Row class
Parameters: row (tuple) – Row values -
etcd_index
¶ A row in etcdb is a key. Etcd index corresponds to X-Etcd-Index in etcd response header.
Returns: Etcd index. Return type: int
-
modified_index
¶ modifiedIndex of a key in etcd
-
row
¶ Returns: Return tuple with row values.. Return type: tuple
-
Module contents¶
PEP-249 implementation for etcd
-
etcdb.
Binary
(string)[source]¶ This function constructs an object capable of holding a binary (long) string value.
-
etcdb.
Date
(year, month, day)[source]¶ This function constructs an object holding a date value.
Parameters: - year – Year, e.g. 2016
- month – Month, e.g. 9
- day – Day, e.g. 21
Returns: EtcdDate instance
-
etcdb.
DateFromTicks
(ticks)[source]¶ This function constructs an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).
Parameters: ticks – Seconds since Epoch Returns: EtcdDate
-
etcdb.
ETCDTABLELOCK
¶ alias of
etcdb.EtcdTableLock
-
etcdb.
Time
(hour, minute, second)[source]¶ This function constructs an object holding a time value.
Parameters: - hour – Hour, e.g. 15
- minute – Minute, e.g. 53
- second – Second, e.g. 16
Returns: EtcdTime instance
-
etcdb.
TimeFromTicks
(ticks)[source]¶ This function constructs an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).
Parameters: ticks – Seconds since Epoch Returns: EtcdTime
-
etcdb.
Timestamp
(year, month, day, hour, minute, second)[source]¶ This function constructs an object holding a time stamp value.
Parameters: - year – See Date() and Time() arguments
- month –
- day –
- hour –
- minute –
- second –
Returns: EtcdTimestamp instance
-
etcdb.
TimestampFromTicks
(ticks)[source]¶ This function constructs an object holding a time stamp value from the given ticks value
(number of seconds since the epoch; see the documentation of the standard Python time module for details).
param ticks: Seconds since Epoch return: EtcTimestamp
-
etcdb.
apilevel
= '1.0'¶ supported DB API level.
-
etcdb.
paramstyle
= 'qmark'¶ the type of parameter marker formatting. Question mark style, e.g. …WHERE name=?.
-
etcdb.
threadsafety
= 3¶ the level of thread safety. Threads may share the module, connections and cursors.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/box/etcdb/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
Etcd Database Driver could always use more documentation, whether as part of the official Etcd Database Driver docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/box/etcdb/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up etcdb for local development.
Fork the etcdb repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/etcdb.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv etcdb $ cd etcdb/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ make test-all
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and for PyPy. Check https://travis-ci.org/box/etcdb/pull_requests and make sure that the tests pass for all supported Python versions.
Tips¶
To run a subset of tests:
$ py.test tests/unit/test_parser.py
To run functional tests make sure vagrant VMs are started first:
$ cd vagrant ; vagrant up
Then you can run the functional tests:
$ py.test tests/functional
Credits¶
Development Lead¶
- Box TechOps Database Team <oss@box.com>
Contributors¶
None yet. Why not be the first?