Skip to main content

Space Cloud Client Python API

Project description

Python Client API for Space Cloud

Installation

Coming soon on pip!

Documentation

The complete documentation can be found here.
(Python documentation coming soon)

Quick Start

Create Client Instance

from space_api import API, AND, OR, COND

api = API('demo-project', 'localhost:8081')

# For MongoDB
db = api.mongo()

# For PostgresQL
db = api.postgres()

# For MySQL
db = api.my_sql()

Note: Multiple databases may be used simultaneously.

Insert a document into the database

response = db.insert('books').doc({"name": "MyBook", "author": "John Doe"}).apply()
if response['status'] == 200:
    # Record successfully inserted
    print("Success")
else:
    # An error occurred
    print(response['error'])

Query documents in database

response = db.get('books').sort('-author').apply()
if response['status'] == 200:
    # We got some result
    print(response['result'])
else:
    # An error occurred
    print(response['error'])

Update documents in database

response = db.update_one('books').where(COND("author", "==", "some_author")).set({"author": "myself"}).apply()
if response['status'] == 200:
    # Record successfully updated
    print("Success")
else:
    # An error occurred
    print(response['error'])

Delete documents in database

response = db.delete('books').where(COND('name', '!=', 'Book_name')).apply()
if response['status'] == 200:
    # Record successfully deleted
    print("Success")
else:
    # An error occurred
    print(response['error'])

Call functions directly (Function as a Service)

response = api.call('test_engine', 'test_func', 'params')
print(response)

Authors

Aliabbas Merchant - Initial work

License

Copyright 2019 Space Up Technologies

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

space-api-py-0.1.0.tar.gz (15.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page