Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Wafer Thin Mint, is a package that allows full integration, with ease, to the TastyPie distro.
It provides a simple and elegant way, to connect straight to the DB API's with minimal effort, following the same pattern as the Django DB ORM.
Please see below for instructions on setup, and have a happy usage :)
first add to your installed apps
INSTALLED_APPS = { ... 'wafer_thin_mint', }
following the example below - please add to your settings file
WAFER_THIN_MINT = { # the connector model can either be the default wafer-thin-mint Server to Server auth model, or a bespoke (see "wafer_thin_mint.Connector" for reference) 'connector_model': 'wafer_thin_mint.Connector', # the client information takes the host, suffix (if you dont want json), and table routing urls 'client': { 'host': 'http://127.0.0.1', 'suffix': '?format=json', 'tables': { 'client': '/api/v1/client/', 'territory': '/api/v1/territory/', } } }
In your db api models file (example remote_db.py) add the structures as below, you'll recognise the format from the Django DB ORM - this is intentional to act as a simple and easy to use way to map at a similar db however over a remote API system.
Firstly, import wafer-thin-mint
#########################################
from wafer_thin_mint import core
#########################################
Now we can build our models
#########################################
class Client(core.Model): # now we build our structure, alike the Django DB ORM we list our desired mapping fields and 'type' them # i will list the choices at the end id = core.PrimaryKey client_reference = core.Charfield description = core.Charfield
#######################################
Now we have our model, and its all setup for use! So how do we use it? Well you probably already know how.. you just dont realise it yet.
Again we've maintained the structure of the Django DB ORM and created it like so.
#######################################
from my_app import remote_db
c = Client.objects.get(id=1)
print c.id
print c.description
c = Client.objects.using('my_app.settings').get(id=2)
print c.id
#######################################
Do ensure you set your mapping up correctly however, making sure the points you try to connect to are actually queryable, and also, make sure your TastyPie has the 'exact' pointer in use, as this is essential in the fetching method.
Now finally, what 'types' are available for our fields? Well because we dont want to boil down too many specifics when the remote API will handle most of it, we've generalised the following, this will just prevent the small int/str errors etc
PrimaryKey - do ensure this is used on your pk, especially if you plan on using it with foriegn table references CharField - says it like it is, types a str IntegerField - again, a bit obvious DecimalField - references the Decimal module TextField - again, alike the str ForiegnKey - this is used for identifying your table object, which is possible alike the DB ORM, simply reference your fetched object and all will be mapped accordingly
FAQs
client service API DB ORM to connect with a service running TastyPie
We found that wafer-thin-mint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.