iweltag / zucker Goto Github PK
View Code? Open in Web Editor NEWStraightforward, Pythonic interface for the SugarCRM API
License: MIT License
Straightforward, Pythonic interface for the SugarCRM API
License: MIT License
See the Sugar documentation for details here.
The API could look something like this:
async with client.bulk():
leads_a = Lead.find(Lead.b == 3)
leads_b = Lead.find(Lead.a == 2)
(leads_a, leads_b) = await asyncio.gather(leads_a, leads_b)
Here, we would require that any requests don't be awaited inside the context manager - that must happen afterwards, once they are all registered in some store / cache / whatever. Then, the results can be awaited and will effectively resolve alltogether.
As an alternative, this might be a bit more consice and doesn't need a context manager:
(leads_a, leads_b) = await client.bulk(
Lead.find(Lead.b == 3),
Lead.find(Lead.a == 2),
)
Currently, an upstream null
resolves into this error:
zucker/zucker/model/fields/base.py
Lines 208 to 213 in b45324d
The first idea would be to add an argument when building the field:
optional_string = model.StringField(optional=True)
Or use a wrapper:
optional_integer = model.OptionalField(model.IntegerField())
If find()
gets a keyword argument fields: Iterable[str]
, resulting model objects should only cache those fields. There are two possibilities for what could happen when an unavailable field gets accessed:
__get__
will potentially block / become awaitable depending on the pardigm.refresh
.The latter approach is probably both easier to implement and better to use in terms of supporting both sync and async frameworks.
Sometimes happens when using the same client for a while. Traceback:
File "/home/echobot-connector/.local/lib/python3.8/site-packages/zucker/model/view.py", line 532, in __anext__
new_records = await self.view._module.get_client().bulk(
File "/home/echobot-connector/.local/lib/python3.8/site-packages/zucker/client/base.py", line 619, in bulk
await self._ensure_authentication()
File "/home/echobot-connector/.local/lib/python3.8/site-packages/zucker/client/base.py", line 426, in _ensure_authentication
self._finalize_authentication(auth_job_name, response_code, response_json)
File "/home/echobot-connector/.local/lib/python3.8/site-packages/zucker/client/base.py", line 234, in _finalize_authentication
raise ZuckerException(
zucker.exceptions.ZuckerException: authentication token renewal failed with status code 400
Relevant code:
Lines 236 to 239 in b45324d
A few places are still lacking:
len()
)See here for a roundup of the Sugar-Specifics in upserting: https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/upsert-explained-by-upsert
This is a placeholder issue for the remaining field types that need to be added:
Asynchronous views currently don't support the iteration protocol, so this isn't possible (although mentioned in the docs):
async for lead in Leads.find():
print(lead)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.