clearskies-gql
clearskies bindings for Graph QL. While this may eventually include handlers to create GQL servers, the current focus is just on a backend to interact with GQL servers.
Installation, Documentation, and Usage
To install:
pip3 install clear-skies-gql
Usage
Example
Include this in your binding modules, extend it if you need to specify authentication, and then use it in your models.
import clearskies
import clearskies_gql
def process_pets_from_gql(pets):
for pet in pets.where('name=fido'):
print(pet.species)
class GqlBackendWithAuth(clearskies_gql.backends.GqlBackend):
def __init__(self, requests, environment, logging, my_auth_method):
super().__init__(requests, environment, logging)
self.configure(
url='https://gql.server.example.com',
auth=my_auth_method,
)
class Pet(clearskies.Model):
def __init__(self, gql_backend_with_auth, columns):
super().__init__(gql_backend_with_auth, columns)
def columns_configuration(self):
return OrderedDict([
clearskies.column_types.string('name'),
clearskies.column_types.string('species'),
])
process_pets = clearskies.Application(
clearskies.handlers.Callable,
{'callable': process_pets_from_gql},
binding_modules=[clearskies_gql],
binding_classes=[Pet, GqlBackendWithAuth],
)
Then just wire up your application to a context and you're ready to go!
Record name
clear-skies-gql will use the pluralized and snake_case version of the model class name as the descriptor of the records in GQL, e.g. the above model class results in this query:
query Query {
pets {
name
species
}
}
But you can override this behavior by specifying the table name for your model, e.g.:
class Pet(clearskies.Model):
def __init__(self, gql_backend_with_auth, columns):
super().__init__(gql_backend_with_auth, columns)
@classmethod
def table_name(cls):
return 'whateverYouWant'
def columns_configuration(self):
return OrderedDict([
clearskies.column_types.string('name'),
clearskies.column_types.string('species'),
])
results in this query:
query Query {
whateverYouWant {
name
species
}
}
Server URL
You can also specify the URL to the GQL server by setting the gql_server_url environment variable. If your gql server doesn't require authentication, then you can use the graphql backend directly:
# note: requires the gql_server_url environment variable to point to the server
class Pet(clearskies.Model):
def __init__(self, gql_backend, columns):
super().__init__(gql_backend, columns)
def columns_configuration(self):
return OrderedDict([
clearskies.column_types.string('name'),
clearskies.column_types.string('species'),
])
Metadata
Release files for clear-skies-gql 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clear-skies-gql-0.1.2.tar.gz | 9.2 kB | Without provenance | Details for clear-skies-gql-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clear_skies_gql-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for clear_skies_gql-0.1.2-py3-none-any.whl |
Total release size: 19.7 kB
Release files / clear-skies-gql-0.1.2.tar.gz
| Download URL | clear-skies-gql-0.1.2.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
442f70e878bda25ce17f58ced012705a012a9a6ed3ef8eee0d2a548824751483
|
|
BLAKE2b-256 checksum How to use checksums |
7c3a68a231e11e0c71eef535cb968be7cccfaeb96772f095231f8131976e74a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / clear_skies_gql-0.1.2-py3-none-any.whl
| Download URL | clear_skies_gql-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b26e5cf6bf785d9e2d14ba5f378256ae0303a662ebc3fd8159d656ba3e92aa3
|
|
BLAKE2b-256 checksum How to use checksums |
3da993ed2ed73fdf3cba8b84ad423bd50d9b5c4132e5ecf3bcc0417eb00b9129
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for clear-skies-gql 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.