# AstraDBByteStore

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/storage/astradb/AstraDBByteStore)

## Signature

```python
AstraDBByteStore(
    self,
    collection_name: str,
    token: Optional[str] = None,
    api_endpoint: Optional[str] = None,
    astra_db_client: Optional[AstraDB] = None,
    namespace: Optional[str] = None,
    *,
    async_astra_db_client: Optional[AsyncAstraDB] = None,
    pre_delete_collection: bool = False,
    setup_mode: SetupMode = SetupMode.SYNC,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `collection_name` | `str` | Yes | name of the Astra DB collection to create/use. |
| `token` | `Optional[str]` | No | API token for Astra DB usage. (default: `None`) |
| `api_endpoint` | `Optional[str]` | No | full URL to the API endpoint, such as `https://<DB-ID>-us-east1.apps.astra.datastax.com`. (default: `None`) |
| `astra_db_client` | `Optional[AstraDB]` | No | *alternative to token+api_endpoint*, you can pass an already-created 'astrapy.db.AstraDB' instance. (default: `None`) |
| `async_astra_db_client` | `Optional[AsyncAstraDB]` | No | *alternative to token+api_endpoint*, you can pass an already-created 'astrapy.db.AsyncAstraDB' instance. (default: `None`) |
| `namespace` | `Optional[str]` | No | namespace (aka keyspace) where the collection is created. Defaults to the database's "default namespace". (default: `None`) |
| `setup_mode` | `SetupMode` | No | mode used to create the Astra DB collection (SYNC, ASYNC or OFF). (default: `SetupMode.SYNC`) |
| `pre_delete_collection` | `bool` | No | whether to delete the collection before creating it. If False and the collection already exists, the collection will be used as is. (default: `False`) |

## Extends

- `AstraDBBaseStore[bytes]`
- `ByteStore`

## Constructors

```python
__init__(
    self,
    collection_name: str,
    token: Optional[str] = None,
    api_endpoint: Optional[str] = None,
    astra_db_client: Optional[AstraDB] = None,
    namespace: Optional[str] = None,
    *,
    async_astra_db_client: Optional[AsyncAstraDB] = None,
    pre_delete_collection: bool = False,
    setup_mode: SetupMode = SetupMode.SYNC,
) -> None
```

| Name | Type |
|------|------|
| `collection_name` | `str` |
| `token` | `Optional[str]` |
| `api_endpoint` | `Optional[str]` |
| `astra_db_client` | `Optional[AstraDB]` |
| `namespace` | `Optional[str]` |
| `async_astra_db_client` | `Optional[AsyncAstraDB]` |
| `pre_delete_collection` | `bool` |
| `setup_mode` | `SetupMode` |


## Methods

- [`decode_value()`](https://reference.langchain.com/python/langchain-community/storage/astradb/AstraDBByteStore/decode_value)
- [`encode_value()`](https://reference.langchain.com/python/langchain-community/storage/astradb/AstraDBByteStore/encode_value)

## ⚠️ Deprecated

Deprecated since version 0.0.22.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/storage/astradb.py#L171)