Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Moore committed Mar 3, 2022
1 parent a4c64e6 commit dcabc11
Show file tree
Hide file tree
Showing 59 changed files with 700 additions and 706 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Innoldb Test Coverage
name: qldb-orm Test Coverage

on:
push:
Expand Down Expand Up @@ -33,19 +33,19 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install build
pip install -r ./src/innoldb/tests/requirements.txt
pip install -r ./src/qldb-orm/tests/requirements.txt
curl https://deepsource.io/cli | sh
- name: Build test application
run: |
VERSION=$(cat version.txt)
python -m build
cd dist
pip install innoldb-${VERSION}-py3-none-any.whl
pip install qldb-orm-${VERSION}-py3-none-any.whl
cd ..
shell: bash
- name: Run unit tests and upload coverage
run: |
coverage run --source="./src/innoldb/" \
coverage run --source="./src/qldb-orm/" \
--omit="**/test_*.py","**/__init__.py" \
--module pytest \
--junit-xml=coverage-execution.xml
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# makpar-innolab

## innoldb
## qldb-orm

A simple [Object-Relation-Mapping](https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping) for a serverless [AWS Quantum Ledger Database](https://docs.aws.amazon.com/qldb/latest/developerguide/what-is.html) backend, and a command line utility for querying tables on those ledgers.

Expand All @@ -14,7 +14,7 @@ The idea behind the *ORM* is to map document fields to native Python object attr
**CRUD OPERATIONS**

```python
from innoldb.qldb import Document
from qldb-orm.qldb import Document

# Create a document on `my_table` table.
document = Document('my_table')
Expand All @@ -27,7 +27,7 @@ document.save()
```

```python
from innoldb.qldb import Document
from qldb-orm.qldb import Document

# Load a document from `my_table` table.
document = Document('my_table', id="123456")
Expand All @@ -37,7 +37,7 @@ for val in document.field.nested_data.array:

**Queries**
```python
from innoldb.qldb import Query
from qldb-orm.qldb import Query

query = Query('my-table').find_by(field_name='field value')
for document in query:
Expand All @@ -48,20 +48,20 @@ for document in query:

**CRUD Operations**
```shell
innoldb --table your-table --insert col1=val1 col2=val2 ...
innoldb --table your-table --id 123 --update col1=newval1 col2=newval2
qldb-orm --table your-table --insert col1=val1 col2=val2 ...
qldb-orm --table your-table --id 123 --update col1=newval1 col2=newval2
```

**Queries**
```shell
innoldb --table your-table --find column=this
qldb-orm --table your-table --find column=this
```

### Read The Docs

- [innolqb documentation](https://makpar-innovation-laboratory.github.io/innoldb/)
- [innolqb documentation](https://makpar-innovation-laboratory.github.io/qldb-orm/)

### Code Quality

[![DeepSource](https://deepsource.io/gh/Makpar-Innovation-Laboratory/innoldb.svg/?label=active+issues&show_trend=true&token=0yUpU0SKBmqEg7qNHU2C65C6)](https://deepsource.io/gh/Makpar-Innovation-Laboratory/innoldb/?ref=repository-badge)
[![DeepSource](https://deepsource.io/gh/Makpar-Innovation-Laboratory/innoldb.svg/?label=resolved+issues&show_trend=true&token=0yUpU0SKBmqEg7qNHU2C65C6)](https://deepsource.io/gh/Makpar-Innovation-Laboratory/innoldb/?ref=repository-badge)
[![DeepSource](https://deepsource.io/gh/Makpar-Innovation-Laboratory/qldb-orm.svg/?label=active+issues&show_trend=true&token=0yUpU0SKBmqEg7qNHU2C65C6)](https://deepsource.io/gh/Makpar-Innovation-Laboratory/qldb-orm/?ref=repository-badge)
[![DeepSource](https://deepsource.io/gh/Makpar-Innovation-Laboratory/qldb-orm.svg/?label=resolved+issues&show_trend=true&token=0yUpU0SKBmqEg7qNHU2C65C6)](https://deepsource.io/gh/Makpar-Innovation-Laboratory/qldb-orm/?ref=repository-badge)
26 changes: 13 additions & 13 deletions docs/build/html/CLI.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@



<title>Command Line Usage &#8212; innoldb v1.0.10 documentation</title>
<title>Command Line Usage &#8212; qldb-orm v1.0.10 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/material.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
Expand Down Expand Up @@ -81,7 +81,7 @@
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="index.html" title="innoldb v1.0.10 documentation"
<a href="index.html" title="qldb-orm v1.0.10 documentation"
class="md-header-nav__button md-logo">

<i class="md-icon">&#xe5c3</i>
Expand Down Expand Up @@ -150,7 +150,7 @@
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="index.html" class="md-tabs__link">innoldb v1.0.10 documentation</a></li>
<li class="md-tabs__item"><a href="index.html" class="md-tabs__link">qldb-orm v1.0.10 documentation</a></li>
</ul>
</div>
</nav>
Expand All @@ -162,13 +162,13 @@
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="index.html" title="innoldb v1.0.10 documentation" class="md-nav__button md-logo">
<a href="index.html" title="qldb-orm v1.0.10 documentation" class="md-nav__button md-logo">

<i class="md-icon">&#xe5c3</i>

</a>
<a href="index.html"
title="innoldb v1.0.10 documentation">Innovation Lab</a>
title="qldb-orm v1.0.10 documentation">Innovation Lab</a>
</label>


Expand Down Expand Up @@ -356,45 +356,45 @@

<section class="tex2jax_ignore mathjax_ignore" id="command-line-usage">
<h1 id="cli--page-root">Command Line Usage<a class="headerlink" href="#cli--page-root" title="Permalink to this headline"></a></h1>
<p>Installing the <code class="docutils literal notranslate"><span class="pre">innoldb</span></code> package puts a command line utility on your path. This tool allows you to query the QLDB ledger directly from the command line.</p>
<p>Installing the <code class="docutils literal notranslate"><span class="pre">qldb-orm</span></code> package puts a command line utility on your path. This tool allows you to query the QLDB ledger directly from the command line.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">--table</span></code> argument is required. Queries can be constructed against this table by passing in other arguments. See below for examples of the different queries.</p>
<p>Be sure to export the <strong>LEDGER</strong> environment variable before executing any of these commands,</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span> <span class="nv">LEDGER</span><span class="o">=</span><span class="s1">'ledger-name'</span>
</pre></div>
</div>
<section id="find-document-by-id">
<h2 id="find-document-by-id">Find Document By ID<a class="headerlink" href="#find-document-by-id" title="Permalink to this headline"></a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb --table &lt;table-name&gt; --id &lt;id&gt;
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm --table &lt;table-name&gt; --id &lt;id&gt;
</pre></div>
</div>
</section>
<section id="find-all-documents">
<h2 id="find-all-documents">Find All Documents<a class="headerlink" href="#find-all-documents" title="Permalink to this headline"></a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb --table &lt;table-name&gt; --all
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm --table &lt;table-name&gt; --all
</pre></div>
</div>
</section>
<section id="generate-new-mock-document">
<h2 id="generate-new-mock-document">Generate New Mock Document<a class="headerlink" href="#generate-new-mock-document" title="Permalink to this headline"></a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb --table &lt;table-name&gt; --mock
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm --table &lt;table-name&gt; --mock
</pre></div>
</div>
</section>
<section id="update-field-in-document">
<h2 id="update-field-in-document">Update Field in Document<a class="headerlink" href="#update-field-in-document" title="Permalink to this headline"></a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb --table &lt;table-name&gt; --id &lt;id&gt; --update &lt;field&gt;<span class="o">=</span>&lt;value&gt; &lt;field&gt;<span class="o">=</span>&lt;value&gt; ...
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm --table &lt;table-name&gt; --id &lt;id&gt; --update &lt;field&gt;<span class="o">=</span>&lt;value&gt; &lt;field&gt;<span class="o">=</span>&lt;value&gt; ...
</pre></div>
</div>
</section>
<section id="insert-document">
<h2 id="insert-document">Insert Document<a class="headerlink" href="#insert-document" title="Permalink to this headline"></a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb --table &lt;table-name&gt; --insert &lt;field&gt;<span class="o">=</span>&lt;value&gt; &lt;field&gt;<span class="o">=</span>&lt;value&gt; ...
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm --table &lt;table-name&gt; --insert &lt;field&gt;<span class="o">=</span>&lt;value&gt; &lt;field&gt;<span class="o">=</span>&lt;value&gt; ...
</pre></div>
</div>
<section id="full-specification">
<h3 id="full-specification">Full Specification<a class="headerlink" href="#full-specification" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>innoldb -h
usage: innoldb <span class="o">[</span>-h<span class="o">]</span> -tb TABLE <span class="o">[</span>-ind INDEX<span class="o">]</span> <span class="o">[</span>-meta META<span class="o">]</span> <span class="o">[</span>-up <span class="o">[</span>UPDATE ...<span class="o">]]</span> <span class="o">[</span>-in <span class="o">[</span>INSERT ...<span class="o">]]</span> <span class="o">[</span>-fi <span class="o">[</span>FIND ...<span class="o">]]</span> <span class="o">[</span>-lo<span class="o">]</span> <span class="o">[</span>-mo<span class="o">]</span> <span class="o">[</span>-uh<span class="o">]</span> <span class="o">[</span>-hst<span class="o">]</span> <span class="o">[</span>-al<span class="o">]</span>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>qldb-orm -h
usage: qldb-orm <span class="o">[</span>-h<span class="o">]</span> -tb TABLE <span class="o">[</span>-ind INDEX<span class="o">]</span> <span class="o">[</span>-meta META<span class="o">]</span> <span class="o">[</span>-up <span class="o">[</span>UPDATE ...<span class="o">]]</span> <span class="o">[</span>-in <span class="o">[</span>INSERT ...<span class="o">]]</span> <span class="o">[</span>-fi <span class="o">[</span>FIND ...<span class="o">]]</span> <span class="o">[</span>-lo<span class="o">]</span> <span class="o">[</span>-mo<span class="o">]</span> <span class="o">[</span>-uh<span class="o">]</span> <span class="o">[</span>-hst<span class="o">]</span> <span class="o">[</span>-al<span class="o">]</span>

optional arguments:
-h, --help Show this <span class="nb">help</span> message and <span class="nb">exit</span>
Expand Down
28 changes: 14 additions & 14 deletions docs/build/html/CONFIGURATION.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@



<title>Configuration &#8212; innoldb v1.0.10 documentation</title>
<title>Configuration &#8212; qldb-orm v1.0.10 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/material.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
Expand Down Expand Up @@ -81,7 +81,7 @@
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="index.html" title="innoldb v1.0.10 documentation"
<a href="index.html" title="qldb-orm v1.0.10 documentation"
class="md-header-nav__button md-logo">

<i class="md-icon">&#xe5c3</i>
Expand Down Expand Up @@ -150,7 +150,7 @@
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="index.html" class="md-tabs__link">innoldb v1.0.10 documentation</a></li>
<li class="md-tabs__item"><a href="index.html" class="md-tabs__link">qldb-orm v1.0.10 documentation</a></li>
</ul>
</div>
</nav>
Expand All @@ -162,13 +162,13 @@
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="index.html" title="innoldb v1.0.10 documentation" class="md-nav__button md-logo">
<a href="index.html" title="qldb-orm v1.0.10 documentation" class="md-nav__button md-logo">

<i class="md-icon">&#xe5c3</i>

</a>
<a href="index.html"
title="innoldb v1.0.10 documentation">Innovation Lab</a>
title="qldb-orm v1.0.10 documentation">Innovation Lab</a>
</label>


Expand Down Expand Up @@ -319,35 +319,35 @@ <h1 id="configuration--page-root">Configuration<a class="headerlink" href="#conf
<h2 id="log-level">Log Level<a class="headerlink" href="#log-level" title="Permalink to this headline"></a></h2>
<p>The log level can be set through the environment variable <strong>LOG_LEVEL</strong> to the values: <code class="docutils literal notranslate"><span class="pre">NOTSET</span></code>, <code class="docutils literal notranslate"><span class="pre">INFO</span></code>, <code class="docutils literal notranslate"><span class="pre">DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">ERROR</span></code>,</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span> <span class="nv">LOG_LEVEL</span><span class="o">=</span><span class="s1">'INFO'</span>
innoldb --table table-name --all
qldb-orm --table table-name --all
</pre></div>
</div>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>

<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">'LOG_LEVEL'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'DEBUG'</span>

<span class="kn">from</span> <span class="nn">innoldb.qldb</span> <span class="kn">import</span> <span class="n">Query</span>
<span class="kn">from</span> <span class="nn">qldb-orm.qldb</span> <span class="kn">import</span> <span class="n">Query</span>

<span class="n">Query</span><span class="p">(</span><span class="s1">'table-name'</span><span class="p">)</span><span class="o">.</span><span class="n">get_all</span><span class="p">()</span>
</pre></div>
</div>
<p>.. note::
The environment must be set before the <code class="docutils literal notranslate"><span class="pre">innoldb</span></code> import. During the import, <code class="docutils literal notranslate"><span class="pre">innoldb</span></code> will scan the environment and use the value it finds on its initial load.</p>
The environment must be set before the <code class="docutils literal notranslate"><span class="pre">qldb-orm</span></code> import. During the import, <code class="docutils literal notranslate"><span class="pre">qldb-orm</span></code> will scan the environment and use the value it finds on its initial load.</p>
</section>
<section id="build-from-source">
<h2 id="build-from-source">Build From Source<a class="headerlink" href="#build-from-source" title="Permalink to this headline"></a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">innoldb</span></code> library can be built from source with the following script,</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/Makpar-Innovation-Laboratory/innoldb
<span class="nb">cd</span> innoldb
<p>The <code class="docutils literal notranslate"><span class="pre">qldb-orm</span></code> library can be built from source with the following script,</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/Makpar-Innovation-Laboratory/qldb-orm
<span class="nb">cd</span> qldb-orm
python -m build
<span class="nv">VERSION</span><span class="o">=</span><span class="k">$(</span>cat version.txt<span class="k">)</span>
<span class="nb">cd</span> dist
pip install innoldb-<span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span>-py3-none-any.whl
pip install qldb-orm-<span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span>-py3-none-any.whl
</pre></div>
</div>
<p>Or use the pre-packaged helper script,</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/Makpar-Innovation-Laboratory/innoldb
./innoldb/scripts/install
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/Makpar-Innovation-Laboratory/qldb-orm
./qldb-orm/scripts/install
</pre></div>
</div>
</section>
Expand Down
Loading

0 comments on commit dcabc11

Please sign in to comment.