### Installing pyrqlite from a Tarball Source: https://github.com/rqlite/pyrqlite/blob/master/README.rst This sequence of commands downloads a specific version of pyrqlite as a tarball, extracts it, and then installs the package using `setup.py`. This is an alternative installation method when `pip` is unavailable or a specific release version is required, allowing for offline installation after download. ```Shell $ # X.Y.Z is the desired pyrqlite version (e.g. 2.2.1). $ curl -L https://github.com/rqlite/pyrqlite/archive/refs/tags/vX.Y.Z.tar.gz | tar xz $ cd pyrqlite* $ python setup.py install $ # The folder pyrqlite* can be safely removed now. ``` -------------------------------- ### Installing pyrqlite from Source Source: https://github.com/rqlite/pyrqlite/blob/master/README.rst These commands clone the pyrqlite repository, navigate into the project directory, and then install the package using `setup.py`. This method allows installation from a local copy of the source code, useful for development or specific version control scenarios. ```Shell $ git clone https://github.com/rqlite/pyrqlite.git $ cd pyrqlite $ python setup.py install ``` -------------------------------- ### Installing pyrqlite via pip from Git Source: https://github.com/rqlite/pyrqlite/blob/master/README.rst This command installs the pyrqlite library directly from its GitHub repository using pip, pulling the latest development version. It requires Git to be installed on the system for successful execution. ```Shell $ pip install git+https://github.com/rqlite/pyrqlite.git ``` -------------------------------- ### Running pyrqlite Test Suite Source: https://github.com/rqlite/pyrqlite/blob/master/README.rst This command executes the test suite for the pyrqlite library using `setup.py`. It requires `pytest` and `pytest-cov` to be installed for the tests to run successfully, ensuring the library functions as expected. ```Shell $ python setup.py test ``` -------------------------------- ### Connecting and Executing Statements with pyrqlite Source: https://github.com/rqlite/pyrqlite/blob/master/README.rst This Python example demonstrates how to establish a connection to an rqlite server, create a table, insert multiple records using `executemany`, and query data using both qmark and named parameter styles. It showcases basic CRUD operations with the `pyrqlite.dbapi2` module, including proper connection handling with `try...finally`. ```Python import pyrqlite.dbapi2 as dbapi2 # Connect to the database connection = dbapi2.connect( host='localhost', port=4001, ) try: with connection.cursor() as cursor: cursor.execute('CREATE TABLE foo (id integer not null primary key, name text)') cursor.executemany('INSERT INTO foo(name) VALUES(?)', seq_of_parameters=(('a',), ('b',))) with connection.cursor() as cursor: # Read a single record with qmark parameter style sql = "SELECT `id`, `name` FROM `foo` WHERE `name`=?" cursor.execute(sql, ('a',)) result = cursor.fetchone() print(result) # Read a single record with named parameter style sql = "SELECT `id`, `name` FROM `foo` WHERE `name`=:name" cursor.execute(sql, {'name': 'b'}) result = cursor.fetchone() print(result) finally: connection.close() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.