Skip to main content

One way sync python dicts to airtable.

Project description

README

This tool provides one-way idempotent sync from python dicts. Uses airtable-python-wrapper for access to airtable REST API.

Installing

pip install atsync

Documentation

Just this README so far

Usage example

This library is small and simple and only does one thing: upsert dicts into airtable.

# Define each related table in a list of dicts
related_tables = [
    {
        'table_name': 'Contact Details',
        'primary_key': 'Email Address',  # primary key of this related table
        'related_on': 'Email',  # key in our target table that is related to this table
    },
]

# Define your target table with an atsync Table instance
sync_table = atsync.Table(table_name='User Table',
                          primary_key='User ID',  # primary key as seen in the airtable user interface
                          'base_key': 'appZZZZZZZZZZZZZZ',  # Can be found in the url of your api doco (see below)*
                          'api_key': 'keyABCDEFG',  # Can be found in the api doco (see below)*
                          related_tables=related_tables)

# Assumes all the fields in users.csv are also in airtable
with open('users.csv', 'r') as user_file:
    import csv
    users = csv.DictReader(user_file)
    for user in users:
        sync_table.update_record(user)  # updates existing reocrd with same primary key, otherwise inserts a new record

* To find your base_key and api_key, open Airtable, click the help link on the top right, choose "API Documentation".

  • Your base_key will be the first section of url after the domain: airtable.com/>>this bit<</api/docs#...
  • Your api_key can be found by clicking the "show API key" checkbox at the top right of the page

License

MIT

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

atsync-1.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

atsync-1.0.1-py2.py3-none-any.whl (3.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file atsync-1.0.1.tar.gz.

File metadata

  • Download URL: atsync-1.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for atsync-1.0.1.tar.gz
Algorithm Hash digest
SHA256 894ada8b1b4f35c56a48ec23933781664a129e747eea575f4e5731b2c9756229
MD5 ba9b038cbbb67b08a77204ba52aff77a
BLAKE2b-256 f7f0616bd57674f1bbb17ea4bae923c0cc8439994cb713f092e0e2e2336294ed

See more details on using hashes here.

File details

Details for the file atsync-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for atsync-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 49b031a570bdea07eb187b8d4a5215c1f9cd2866e73c53b18ea62d990b6a5361
MD5 56cf7f53329cb3af95c9c5135f59a78d
BLAKE2b-256 5afdcedb77e7826d689031dc8bb13e2bbe99521a9d4410e70121fb2302ca56e2

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