elchicodepython
python-nocodb
Python

NocoDB Python API Client

Last updated Jun 17, 2026
76
Stars
20
Forks
12
Issues
0
Stars/day
Attention Score
6
Language breakdown
Python 100.0%
โ–ธ Files click to expand
README

NocoDB Python Client

NocoDB is a great Airtable alternative. This client allows python developers to use NocoDB API in a simple way.

Installation

pip install nocodb

Usage

Client configuration

from nocodb.nocodb import NocoDBProject, APIToken, JWTAuthToken
from nocodb.filters import LikeFilter, EqFilter, And
from nocodb.infra.requests_client import NocoDBRequestsClient

Usage with API Token

client = NocoDBRequestsClient( # Your API Token retrieved from NocoDB conf APIToken("YOUR-API-TOKEN"), # Your nocodb root path "http://localhost:8080" )

Usage with JWT Token

client = NocoDBRequestsClient( # Your API Token retrieved from NocoDB conf JWTAuthToken("your.jwt.token"), # Your nocodb root path "http://localhost:8080" )

Project creation

# Example with default database
project_body = {"title": "My new project"}

Example with Postgresql

project_body = { "title": "MyProject", "bases": [ { "type": "pg", "config": { "client": "pg", "connection": { "host": "localhost", "port": "5432", "user": "postgres", "password": "postgres", "database": "postgres" }, "searchPath": [ "public" ] }, "inflection_column": "camelize", "inflection_table": "camelize" } ], "external": True }

project = client.projectcreate(body=projectbody)

Project selection

# Be very carefull with org, project_name and table names

weird errors from nocodb can arrive if they are wrong

example: id is not defined...

probably they will fix that in a future release.

project = NocoDBProject( "noco", # org name. noco by default "myproject" # project name. Case sensitive!! )

Table rows operations

table_name = "tablename"

Retrieve a page of rows from a table

tablerows = client.tablerowlist(project, tablename)

Retrieve the first 1000 rows

tablerows = client.tablerowlist(project, tablename, params={'limit': 1000})

Skip 100 rows

tablerows = client.tablerowlist(project, tablename, params={'offset': 100})

โš ๏ธ Seems that we can't retrieve more than 1000 rows at the same time but we can paginate to retrieve all the rows from a table

Pagination example

first100rows = client.tablerowlist(project, table_name, params={'limit': 100})
next100rows = client.tablerowlist(project, table_name, params={'limit': 100, 'offset': 100})
next100rows = client.tablerowlist(project, table_name, params={'limit': 100, 'offset': 200})

More row operations

# Filter the query
tablerows = client.tablerowlist(project, tablename, LikeFilter("name", "%sam%"))
tablerows = client.tablerowlist(project, tablename, And(LikeFilter("name", "%sam%"), EqFilter("age", 26)))
tablerows = client.tablerowlist(project, tablename, filter_obj=EqFilter("Id", 100))

Filter and count rows

count = client.tablecount(project, tablename, filter_obj=EqFilter("Id", 100))

Find one row

tablerow = client.tablefindone(project, tablename, filterobj=EqFilter("Id", 100), params={"sort": "-createdat"})

Retrieve a single row

row_id = 10 row = client.tablerowdetail(project, tablename, rowid)

Create a new row

row_info = { "name": "my thoughts", "content": "i'm going to buy samuel a beer ๐Ÿป because I ๐Ÿ’š this module", "mood": ":)" } client.tablerowcreate(project, tablename, rowinfo)

Update a row

row_id = 2 row_info = { "content": "i'm going to buy samuel a new car ๐Ÿš™ because I ๐Ÿ’š this module", } client.tablerowupdate(project, tablename, rowid, row_info)

Delete a row (only if you've already bought me a beer)

client.tablerowdelete(project, tablename, rowid)

Available filters

  • EqFilter
  • EqualFilter (Alias of EqFilter)
  • NotEqualFilter
  • GreaterThanFilter
  • GreaterOrEqualFilter
  • LessThanFilter
  • LessOrEqualFilter
  • LikeFilter
  • Or
  • Not
  • And

Combining filters using Logical operations

from nocodb import filters

Basic filters...

nick_filter = filters.EqFilter("nickname", "elchicodepython") country_filter = filters.EqFilter("country", "es") girlfriend_code = filters.EqFilter("gfcode", "404") currentmoodcode = filters.EqFilter("moodcode", "418")

Combining filters using logical filters

orfilter = filters.Or(nickfilter, country_filter) andfilter = filters.And(girlfriendcode, currentmoodcode)

Negating filters with a Not filter

not_me = filters.Not(filters.EqFilter("nickname", "elchicodepython"))

You can also combine combinations

orcombinedfilter = filters.Or(orfilter, andfilter) andcombinedfilter = filters.And(orfilter, andfilter)

Using custom filters

Nocodb is evolving and new operators are coming with each release.

Most of the basic operations are inside this package but you could need some new feature that could not be added yet. For those filters you can build your own.

Example for basic filters:

from nocodb.filters.factory import basicfilterclass_factory

BasicFilter = basicfilterclass_factory('=') tablerows = client.tablerowlist(project, tablename, BasicFilter('age', '16'))

You can find the updated list of all the available nocodb operators here.

In some cases you might want to write your own filter string as described in the previous link. For that cases you can use the less-semmantic RawFilter.

from nocodb.filters.raw_filter import RawFilter

tablerows = client.tablerowlist(project, tablename, RawFilter('(birthday,eq,exactDate,2023-06-01)'))

In some cases we might want to have a file with some custom raw filters already defined by us. We can easily create custom raw filter classes using rawtemplatefilterclassfactory.

from nocodb.filters.factory import rawtemplatefilterclassfactory

BirthdayDateFilter = rawtemplatefilterclassfactory('(birthday,eq,exactDate,{})') ExactDateEqFilter = rawtemplatefilterclassfactory('({},eq,exactDate,{})') ExactDateOpFilter = rawtemplatefilterclassfactory('({},{op},exactDate,{})')

tablerows = client.tablerowlist(project, tablename, BirthdayDateFilter('2023-06-01')) tablerows = client.tablerowlist(project, tablename, ExactDateEqFilter('column', '2023-06-01')) tablerows = client.tablerowlist(project, tablename, ExactDateOpFilter('column', '2023-06-01', op='eq'))

Credits to @MitPitt for asking this feature.

Author notes

I created this package to bootstrap some personal projects and I hope it will help other developers from the python community. It's not completed but it has what I needed: A full CRUD with some filters.

Feel free to add new capabilities by creating a new MR.

Contributors

Contributors image

  • Samuel Lรณpez Saura @elchicodepython
  • Ilya Sapunov @davert0
  • Delena Malan @delenamalan
  • Jan Scheiper @jangxx

ยฉ 2026 GitRepoTrend ยท elchicodepython/python-nocodb ยท Updated daily from GitHub