



  

Python Client for Pilosa 0.3.30 documentation

 [Python Client for Pilosa](index.html#document-index) 

 stable

 

Contents:

* [pilosa package](index.html#document-pilosa)

	+ [Submodules](index.html#submodules)

	+ [pilosa.client module](index.html#pilosa-client-module)

	+ [pilosa.exceptions module](index.html#pilosa-exceptions-module)

	+ [pilosa.orm module](index.html#pilosa-orm-module)

	+ [pilosa.response module](index.html#pilosa-response-module)

	+ [pilosa.validator module](index.html#pilosa-validator-module)

	+ [pilosa.version module](index.html#pilosa-version-module)

	+ [Module contents](index.html#module-contents)

[Python Client for Pilosa](index.html#document-index)

* [Docs](index.html#document-index) »

* Python Client for Pilosa 0.3.30 documentation

* [Edit on GitHub](https://github.com/pilosa/python-pilosa/blob/28597d10623db6f5e5da05e731310931a899d0f4/doc/index.rst)

---

Welcome to Python Client for Pilosa’s documentation![¶](#welcome-to-python-client-for-pilosa-s-documentation "Permalink to this headline")

==========================================================================================================================================

Python client for [Pilosa](https://www.pilosa.com) high performance distributed row index.

pilosa package[¶](#pilosa-package "Permalink to this headline")

---------------------------------------------------------------

### Submodules[¶](#submodules "Permalink to this headline")

### pilosa.client module[¶](#pilosa-client-module "Permalink to this headline")

### pilosa.exceptions module[¶](#pilosa-exceptions-module "Permalink to this headline")

### pilosa.orm module[¶](#pilosa-orm-module "Permalink to this headline")

### pilosa.response module[¶](#pilosa-response-module "Permalink to this headline")

### pilosa.validator module[¶](#pilosa-validator-module "Permalink to this headline")

### pilosa.version module[¶](#pilosa-version-module "Permalink to this headline")

### Module contents[¶](#module-contents "Permalink to this headline")

Requirements[¶](#requirements "Permalink to this headline")

-----------------------------------------------------------

* Python 2.7 and higher or Python 3.4 and higher.

Install[¶](#install "Permalink to this headline")

-------------------------------------------------

Pilosa client is on [PyPI](https://pypi.python.org/pypi/pilosa). You

can install the library using `pip`:

```

pip install pilosa

```

Quick overview[¶](#quick-overview "Permalink to this headline")

---------------------------------------------------------------

Assuming [Pilosa](https://github.com/pilosa/pilosa) server is running

at `localhost:10101` (the default):

```

import pilosa

# Create the default client

client = pilosa.Client()

# Retrieve the schema

schema = client.schema()

# Create an Index object

myindex = schema.index("myindex")

# Create a Field object

myfield = myindex.field("myfield")

# make sure the index and field exists on the server

client.sync\_schema(schema)

# Send a SetBit query. PilosaError is thrown if execution of the query fails.

client.query(myfield.set(5, 42))

# Send a Bitmap query. PilosaError is thrown if execution of the query fails.

response = client.query(myfield.row(5))

# Get the result

result = response.result

# Act on the result

if result:

    columns = result.row.columns

    print("Got columns: ", columns)

# You can batch queries to improve throughput

response = client.query(

    myindex.batch\_query(

        myfield.row(5),

        myfield.row(10),

    )

)

for result in response.results:

    # Act on the result

    print(result)

```

Indices and tables[¶](#indices-and-tables "Permalink to this headline")

=======================================================================

* [Index](genindex.html)

* [Module Index](py-modindex.html)

* [Search Page](search.html)

