Skip to main content

Example SDK usage - Python

The below code covers a scenario for some back-end system where some process must fetch stock data from a database (e.g. MySQL) and process this data so that it is in a format required by the client to display, based on a ticker symbol and fetching and processing this data is expensive. Caching the data provides a way of speeding up this process.

from GhostDB.cache import Cache

cache = Cache("my_ghostdb.conf")

def getStockData(ticker_smbl):
    # Fetch data from cache
    stock_data = cache.get(ticker_smbl)

    if not stock_data:
        # Fetch from MySQL.
        # After any processing, we can 
        # assume our computed value is stored in
        # a variable called stock_data

        # Store result in cache
        cache.put(ticker_smbl, stock_data)
    return stock_data

return getStockData("AMZN")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghostdb-0.9.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghostdb-0.9-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file ghostdb-0.9.tar.gz.

File metadata

  • Download URL: ghostdb-0.9.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for ghostdb-0.9.tar.gz
Algorithm Hash digest
SHA256 c4ca5912ae28bc1bb8d5150cc43e8bde59e907ba423d487e4e335ec210c2edb2
MD5 11a18af266821779a55682969555f815
BLAKE2b-256 6779f9b90ad57f3bdcb96257744840245424c52b4b5ecfe8e620b77810a4b0ce

See more details on using hashes here.

File details

Details for the file ghostdb-0.9-py3-none-any.whl.

File metadata

  • Download URL: ghostdb-0.9-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for ghostdb-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc2b89e6650af50cfb908cfb1a120d126ecdc79eae50b0f08cfe70ab4347d8a
MD5 b6968fd5efda23aa7c224a3588d0a2c0
BLAKE2b-256 79ffce231d50d812ce3949c8ee2dceaa1ac5a1f97b7962d230ffb8a4c85bce52

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9 This release

2 files

0.8

2 files

0.7

2 files

0.6

2 files

0.5

2 files

0.4

2 files

0.3

2 files

0.2

2 files

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page