Skip to main content

Utility for caching api responses from the airtable-python-wrapper

Project description

Airtable Caching

PyPI PyPI - Downloads PyPI - License

Utility for caching api responses from the airtable-python-wrapper and provides an ORM style interface for querying cached records.

Dummy api key and base keys provided below for testing. Please do not modify anything using this key, or I will have to take this option away.

Installation

pip install airtable-caching

Step 1 - Import classes

from airtable_caching import Base, Table

Step 2 - cache a table

base = Base(base_id="appjMwyFviPaM9I0L", api_key="keyqhxncgPbSySJQN")
base.cache_table("Table 1")

Step 3 - Access cached data

table = Table(base_id="appjMwyFviPaM9I0L", table_name="Table 1")

# get single record by it's airtable record ID
table.get('rec4trz5QrB6aWJBw')

# get all records in the table
table.query().all()

# get all records and resolve linked fields
table.query(resolve_fields={"Table 2": "Link to Table 2"}).all()

# get the first record in table
table.query().first()

# get the last record in table
table.query().last()

# filtering records in the query
table.query().filter_by({"Name": "Data entry 1 from Table 1 from Base 1"}).all()

# ordering records in the query
table.query().order_by("Number").all()

# ordering records in the query (descending)
table.query().order_by("Number", desc=True).all()

Defining a custom cache folder location

By default this stores all cached data as .json files in airtable_caching/json. You can optionally pass a custom folder location to the Base and Table classes.

import os
custom_json_folder = os.path.join(os.path.dirname(__file__), "custom_json")
base = Base(
    base_id="appjMwyFviPaM9I0L",
    api_key="keyqhxncgPbSySJQN",
    json_folder=custom_json_folder,
)
table = Table(
    base_id="appjMwyFviPaM9I0L",
    table_name="Table 1",
    json_folder=self.custom_json_folder,
)

Changelog

0.0.4

Updated

  • README and docstrings

0.0.3

Changed

  • (BREAKING) Base and Table classes no longer use base name, now they use base id (see docs)
  • added option for supplying custom cache location

Added

  • Documentation
  • Tests

0.0.1 - 0.0.2

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airtable-caching-0.0.5.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

airtable_caching-0.0.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file airtable-caching-0.0.5.tar.gz.

File metadata

  • Download URL: airtable-caching-0.0.5.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for airtable-caching-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6763a40d885285da4d34cc48fb36ff84516fd7ebc91d085294c466453b02a86a
MD5 720b24c7754df04b9d06ede72b7aa699
BLAKE2b-256 ef9244c5765356f6ad92e3eb8d2bae1a80290260dcfb1208315905c1c5d84c7c

See more details on using hashes here.

File details

Details for the file airtable_caching-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: airtable_caching-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for airtable_caching-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e42edf6fd94195060ed81e5407528d65a4c3460e32b011fcd8c76057a9396a3
MD5 6c510e9e778d27ecba49083d974a1c98
BLAKE2b-256 1e929490589c34c689543b5a555528d06f31595121e88a590705ecdc3d4ce34b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page