A lightweight model maker for quickbase
Project description
quickbase-model-maker
A lightweight tool for creating and managing QuickBase models!
Turn this 👎
# select relevant info
select = [3, 43, 23, 63, 21, 52, 24, 54]
Into this 👍
from references.order_manager import Order
select = [
Order.RECORD_ID,
Order.ORDER_TYPE,
Order.ORDER_NUMBER,
Order.DELIVERY_DATE
...
]
With just a few lines of code!
Installation
pip install quickbase-model-maker
Usage
Initializing
The sample code below will initialize your models for use in your application. Models are created within their respective app folders, in a new directory called references.
# import model maker
from quickbase_model_maker import ModelMaker
# create model maker with realm and auth info
qmm = ModelMaker(realm='realm', auth='AUTH-TOKEN')
# register tables you wish to create models from
qmm.register_tables([
('bqs5asdf', 'bqs5aser'), # ('app_id', 'table_id') tuples
('bqs5abzc', 'brzaners'),
('bqs5abzc', 'brzanvac'),
('bqs5abzc', 'bqs5wers'),
])
Generate your models, based off of the registered tables, with the .sync() method.
# call sync method to create models
qmm.sync(only_new_tables=True)
Optionally, you can sync all registered tables, regardless of whether they have already been synced.
It is recommended to call .sync()
only when you wish to re-generate models, as each model sync with Quickbase costs 1 API call. You only have to generate
models once - or when you wish to update your models (i.e. new field you need to access added on quickbase). Calling .sync() on
every script run could result in a large number of API calls.
qmm.sync()
In code
Once registered and created, models can be used in your application.
The following code uses a fictional "Order" model to demonstrate
how one can access the ORDER_TYPE field. One can also access useful metadata
through methods like .table_id() and .app_id().
from references.orders import Order
print(Order.ORDER_TYPE)
print(Order.table_id())
Removing Models
Models can easily be removed by doing the following:
- Remove the model from the
references/appdirectory - Remove the related table from the
references/__init__.pyfile. - Remove the related table tuple from the
.register_tables()method.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quickbase_model_maker-0.1.2.tar.gz.
File metadata
- Download URL: quickbase_model_maker-0.1.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f83f876364650219d956e03caebaeece9419c04d55ce612426cec760fbd6a3
|
|
| MD5 |
f57958b7b8d684622c7cabdd680181cb
|
|
| BLAKE2b-256 |
714ee1972ce089402403556d1f5707bbe494059530cb3ddcaa6029d2ce7fdbeb
|
File details
Details for the file quickbase_model_maker-0.1.2-py3-none-any.whl.
File metadata
- Download URL: quickbase_model_maker-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ba83061d0fea17fdf82af248c93bc4cba20ffb9ca92286ca432c02dfc3c6ca
|
|
| MD5 |
dd89eaf00930748b5d85c91c870f7d40
|
|
| BLAKE2b-256 |
7783c5ca15dea3d40910108ee57a629e54ccba78da62c4d1db08ef4ae577eb19
|