{"id":13930153,"url":"https://github.com/elchicodepython/python-nocodb","last_synced_at":"2026-01-18T00:04:56.438Z","repository":{"id":57699338,"uuid":"502729694","full_name":"elchicodepython/python-nocodb","owner":"elchicodepython","description":"NocoDB Python API Client","archived":false,"fork":false,"pushed_at":"2023-10-31T14:26:19.000Z","size":28,"stargazers_count":64,"open_issues_count":12,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-14T16:52:09.354Z","etag":null,"topics":["api-client","databases","nocodb","nocode","python3","python3-library"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/nocodb/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elchicodepython.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"ko_fi":"elchicodepython"}},"created_at":"2022-06-12T21:15:38.000Z","updated_at":"2024-11-07T21:38:53.000Z","dependencies_parsed_at":"2022-09-26T21:12:17.237Z","dependency_job_id":"d6ac6e65-4aa2-4854-b5d5-a7a5fcf55634","html_url":"https://github.com/elchicodepython/python-nocodb","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":"0.30434782608695654","last_synced_commit":"d64b2a81bd442dd982951618dfac2cef2c736002"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elchicodepython%2Fpython-nocodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elchicodepython%2Fpython-nocodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elchicodepython%2Fpython-nocodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elchicodepython%2Fpython-nocodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elchicodepython","download_url":"https://codeload.github.com/elchicodepython/python-nocodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226607598,"owners_count":17658482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","databases","nocodb","nocode","python3","python3-library"],"created_at":"2024-08-07T18:04:55.841Z","updated_at":"2026-01-18T00:04:56.426Z","avatar_url":"https://github.com/elchicodepython.png","language":"Python","readme":"# NocoDB Python Client\n\nNocoDB is a great Airtable alternative. This client allows python developers\nto use NocoDB API in a simple way.\n\n- [Contributors guidelines](contributors.md)\n\n## Installation\n\n```bash\npip install nocodb\n```\n\n## Usage\n\n### Client configuration\n```python\nfrom nocodb.nocodb import NocoDBProject, APIToken, JWTAuthToken\nfrom nocodb.filters import LikeFilter, EqFilter, And\nfrom nocodb.infra.requests_client import NocoDBRequestsClient\n\n\n# Usage with API Token\nclient = NocoDBRequestsClient(\n        # Your API Token retrieved from NocoDB conf\n        APIToken(\"YOUR-API-TOKEN\"),\n        # Your nocodb root path\n        \"http://localhost:8080\"\n)\n\n# Usage with JWT Token\nclient = NocoDBRequestsClient(\n        # Your API Token retrieved from NocoDB conf\n        JWTAuthToken(\"your.jwt.token\"),\n        # Your nocodb root path\n        \"http://localhost:8080\"\n)\n```\n\n### Project creation\n```python\n# Example with default database\nproject_body = {\"title\": \"My new project\"}\n\n# Example with Postgresql\nproject_body = {\n    \"title\": \"MyProject\",\n    \"bases\": [\n        {\n            \"type\": \"pg\",\n            \"config\": {\n                \"client\": \"pg\",\n                \"connection\": {\n                    \"host\": \"localhost\",\n                    \"port\": \"5432\",\n                    \"user\": \"postgres\",\n                    \"password\": \"postgres\",\n                    \"database\": \"postgres\"\n                },\n                \"searchPath\": [\n                    \"public\"\n                ]\n            },\n            \"inflection_column\": \"camelize\",\n            \"inflection_table\": \"camelize\"\n        }\n    ],\n    \"external\": True\n}\n\nproject = client.project_create(body=project_body)\n```\n\n### Project selection\n```python\n# Be very carefull with org, project_name and table names\n# weird errors from nocodb can arrive if they are wrong\n# example: id is not defined...\n# probably they will fix that in a future release.\nproject = NocoDBProject(\n        \"noco\", # org name. noco by default\n        \"myproject\" # project name. Case sensitive!!\n)\n\n```\n\n### Table rows operations\n```python\ntable_name = \"tablename\"\n\n# Retrieve a page of rows from a table\ntable_rows = client.table_row_list(project, table_name)\n\n# Retrieve the first 1000 rows\ntable_rows = client.table_row_list(project, table_name, params={'limit': 1000})\n\n# Skip 100 rows\ntable_rows = client.table_row_list(project, table_name, params={'offset': 100})\n```\n\n⚠️ Seems that we can't retrieve more than 1000 rows at the same time but we can paginate\n to retrieve all the rows from a table\n\nPagination example\n\n```python\n\nfirst_100_rows = client.table_row_list(project, table_name, params={'limit': 100})\nnext_100_rows = client.table_row_list(project, table_name, params={'limit': 100, 'offset': 100})\nnext_100_rows = client.table_row_list(project, table_name, params={'limit': 100, 'offset': 200})\n```\n\nMore row operations\n\n```python\n# Filter the query\ntable_rows = client.table_row_list(project, table_name, LikeFilter(\"name\", \"%sam%\"))\ntable_rows = client.table_row_list(project, table_name, And(LikeFilter(\"name\", \"%sam%\"), EqFilter(\"age\", 26)))\ntable_rows = client.table_row_list(project, table_name, filter_obj=EqFilter(\"Id\", 100))\n\n# Filter and count rows\ncount = client.table_count(project, table_name, filter_obj=EqFilter(\"Id\", 100))\n\n# Find one row\ntable_row = client.table_find_one(project, table_name, filter_obj=EqFilter(\"Id\", 100), params={\"sort\": \"-created_at\"})\n\n# Retrieve a single row\nrow_id = 10\nrow = client.table_row_detail(project, table_name, row_id)\n\n# Create a new row\nrow_info = {\n    \"name\": \"my thoughts\",\n    \"content\": \"i'm going to buy samuel a beer 🍻 because I 💚 this module\",\n    \"mood\": \":)\"\n}\nclient.table_row_create(project, table_name, row_info)\n\n# Update a row\nrow_id = 2\nrow_info = {\n    \"content\": \"i'm going to buy samuel a new car 🚙 because I 💚 this module\",\n}\nclient.table_row_update(project, table_name, row_id, row_info)\n\n# Delete a row (only if you've already bought me a beer)\nclient.table_row_delete(project, table_name, row_id)\n```\n\n### Available filters\n\n- EqFilter\n- EqualFilter (Alias of EqFilter)\n- NotEqualFilter\n- GreaterThanFilter\n- GreaterOrEqualFilter\n- LessThanFilter\n- LessOrEqualFilter\n- LikeFilter\n- Or\n- Not\n- And\n\n#### Combining filters using Logical operations\n\n```python\nfrom nocodb import filters\n\n# Basic filters...\nnick_filter = filters.EqFilter(\"nickname\", \"elchicodepython\")\ncountry_filter = filters.EqFilter(\"country\", \"es\")\ngirlfriend_code = filters.EqFilter(\"gfcode\", \"404\")\ncurrent_mood_code = filters.EqFilter(\"moodcode\", \"418\")\n\n# Combining filters using logical filters\nor_filter = filters.Or(nick_filter, country_filter)\nand_filter = filters.And(girlfriend_code, current_mood_code)\n\n# Negating filters with a Not filter\nnot_me = filters.Not(filters.EqFilter(\"nickname\", \"elchicodepython\"))\n\n# You can also combine combinations\nor_combined_filter = filters.Or(or_filter, and_filter)\nand_combined_filter = filters.And(or_filter, and_filter)\n\n```\n\n### Using custom filters\n\nNocodb is evolving and new operators are coming with each release.\n\nMost of the basic operations are inside this package but you could need some new\nfeature that could not be added yet.\nFor those filters you can build your own.\n\nExample for basic filters:\n\n```python\nfrom nocodb.filters.factory import basic_filter_class_factory\n\nBasicFilter = basic_filter_class_factory('=')\ntable_rows = client.table_row_list(project, table_name, BasicFilter('age', '16'))\n\n```\n\nYou can find the updated list of all the available nocodb operators [here](https://docs.nocodb.com/developer-resources/rest-apis/#comparison-operators).\n\nIn some cases you might want to write your own filter string as described in the previous link.\nFor that cases you can use the less-semmantic RawFilter.\n\n```python\nfrom nocodb.filters.raw_filter import RawFilter\n\ntable_rows = client.table_row_list(project, table_name, RawFilter('(birthday,eq,exactDate,2023-06-01)'))\n```\n\nIn some cases we might want to have a file with some custom raw filters already defined by us.\nWe can easily create custom raw filter classes using `raw_template_filter_class_factory`.\n\n```python\nfrom nocodb.filters.factory import raw_template_filter_class_factory\n\nBirthdayDateFilter = raw_template_filter_class_factory('(birthday,eq,exactDate,{})')\nExactDateEqFilter = raw_template_filter_class_factory('({},eq,exactDate,{})')\nExactDateOpFilter = raw_template_filter_class_factory('({},{op},exactDate,{})')\n\ntable_rows = client.table_row_list(project, table_name, BirthdayDateFilter('2023-06-01'))\ntable_rows = client.table_row_list(project, table_name, ExactDateEqFilter('column', '2023-06-01'))\ntable_rows = client.table_row_list(project, table_name, ExactDateOpFilter('column', '2023-06-01', op='eq'))\n```\n\n\nCredits to @MitPitt for asking this feature.\n\n## Author notes\n\nI created this package to bootstrap some personal projects and I hope it\nwill help other developers from the python community. It's not completed but\nit has what I needed: A full CRUD with some filters.\n\nFeel free to add new capabilities by creating a new MR.\n\n## Contributors\n\n![Contributors image](https://contrib.rocks/image?repo=elchicodepython/python-nocodb)\n\n\n- Samuel López Saura @elchicodepython\n- Ilya Sapunov @davert0\n- Delena Malan @delenamalan\n- Jan Scheiper @jangxx\n\n","funding_links":["https://ko-fi.com/elchicodepython"],"categories":["python3"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felchicodepython%2Fpython-nocodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felchicodepython%2Fpython-nocodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felchicodepython%2Fpython-nocodb/lists"}