diff --git a/src/innoldb/examples/__init__.py b/examples/__init__.py similarity index 100% rename from src/innoldb/examples/__init__.py rename to examples/__init__.py diff --git a/src/innoldb/examples/example_document_crud.py b/examples/example_document_crud.py similarity index 96% rename from src/innoldb/examples/example_document_crud.py rename to examples/example_document_crud.py index baa9a8c..68754e1 100644 --- a/src/innoldb/examples/example_document_crud.py +++ b/examples/example_document_crud.py @@ -4,7 +4,7 @@ if __name__=="__main__": # NOTE: Point `innoldb` to the Ledger from which you are reading/writing through the environment - os.environ['LEDGER'] = 'innolab' + # os.environ['LEDGER'] = 'innolab' # NOTE: Import needs to come after environment variable has been set! from innoldb.qldb import Document diff --git a/src/innoldb/examples/example_histories.py b/examples/example_histories.py similarity index 100% rename from src/innoldb/examples/example_histories.py rename to examples/example_histories.py diff --git a/src/innoldb/examples/example_queries.py b/examples/example_queries.py similarity index 98% rename from src/innoldb/examples/example_queries.py rename to examples/example_queries.py index e3c8787..d358c1a 100644 --- a/src/innoldb/examples/example_queries.py +++ b/examples/example_queries.py @@ -4,7 +4,7 @@ if __name__=="__main__": # NOTE: Point `innoldb` to the Ledger from which you are reading/writing through the environment - os.environ['LEDGER'] = 'innolab' + # os.environ['LEDGER'] = 'innolab' # NOTE: Import needs to come after environment variable has been set! The library will scan the environment # on import and set the ledger. diff --git a/src/innoldb/examples/example_strands.py b/examples/example_strands.py similarity index 96% rename from src/innoldb/examples/example_strands.py rename to examples/example_strands.py index b088333..81ba3b0 100644 --- a/src/innoldb/examples/example_strands.py +++ b/examples/example_strands.py @@ -4,7 +4,7 @@ if __name__=="__main__": # NOTE: Point `innoldb` to the Ledger from which you are reading/writing through the environment - os.environ['LEDGER'] = 'schema' + # os.environ['LEDGER'] = 'schema' # NOTE: Import needs to come after environment variable has been set! The library will scan the environment # on import and set the ledger. diff --git a/schemas/v1.0.0.json b/schemas/v1.0.0.json deleted file mode 100644 index ef57341..0000000 --- a/schemas/v1.0.0.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "schema": { - "engine": "postgres", - "tables": [ - { - "name": "test_table", - "columns": [ - { - "name": "primary_key", - "type": "uuid" - }, - { - "name": "sample_field", - "type": "str" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/schemas/v1.0.1.json b/schemas/v1.0.1.json deleted file mode 100644 index 9c2ba40..0000000 --- a/schemas/v1.0.1.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "schema": { - "engine": "postgres", - "tables": [ - { - "name": "test_table", - "columns": [ - { - "name": "primary_key", - "type": "uuid" - }, - { - "name": "sample_string", - "type": "varchar" - }, - { - "name": "sample_int", - "type": "integer" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/schemas/v1.0.2.json b/schemas/v1.0.2.json deleted file mode 100644 index 2a5f274..0000000 --- a/schemas/v1.0.2.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "schema": { - "engine": "postgres", - "tables": [ - { - "name": "test_table", - "columns": [ - { - "name": "primary_key", - "type": "uuid" - }, - { - "name": "sample_string", - "type": "varchar" - }, - { - "name": "sample_int", - "type": "integer" - }, - { - "name": "sample_date", - "type": "date" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/src/innoldb/examples/example_ion/__init__.py b/src/innoldb/examples/example_ion/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/innoldb/examples/example_ion/example_ion_loads.py b/src/innoldb/examples/example_ion/example_ion_loads.py deleted file mode 100644 index 3a7ff6c..0000000 --- a/src/innoldb/examples/example_ion/example_ion_loads.py +++ /dev/null @@ -1,8 +0,0 @@ -from amazon.ion.json_encoder import IonToJSONEncoder -from amazon.ion.simpleion import loads -import json - -value = loads( - '{data: annot::{foo: null.string, bar: (2 + 2)}, time: 1969-07-20T20:18Z}') -json_string = json.dumps(value, cls=IonToJSONEncoder) -print(json_string) diff --git a/src/innoldb/examples/example_schema_vc/__init__.py b/src/innoldb/examples/example_schema_vc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/innoldb/examples/example_schema_vc/example_load_schemas.py b/src/innoldb/examples/example_schema_vc/example_load_schemas.py deleted file mode 100644 index 7384962..0000000 --- a/src/innoldb/examples/example_schema_vc/example_load_schemas.py +++ /dev/null @@ -1,24 +0,0 @@ -import json -import os -from pprint import pprint - -EX_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -SCHEMA_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(EX_DIR))), 'schemas') -VERSIONS= ['v1.0.0', 'v1.0.1', 'v1.0.2'] - -if __name__=="__main__": - - # NOTE: Point `innoldb` to the Ledger from which you are reading/writing through the environment - os.environ['LEDGER'] = 'schema' - - # NOTE: Import needs to come after environment variable has been set! The library will scan the environment - # on import and set the ledger. - from innoldb.qldb import Document - - doc_id = None - for version in VERSIONS: - with open(os.path.join(SCHEMA_DIR, f'{version}.json'), 'r') as infile: - schema = json.load(infile) - doc = Document('version_control', id = doc_id, snapshot=schema) - doc.save() - doc_id = doc.id \ No newline at end of file diff --git a/src/innoldb/qldb.py b/src/innoldb/qldb.py index d3399f6..4fdd418 100644 --- a/src/innoldb/qldb.py +++ b/src/innoldb/qldb.py @@ -209,7 +209,7 @@ def fields(self): :return: `innoldb.qldb.Document` fields :rtype: dict """ - return {key: value for key, value in vars(self).items() if key not in ['table', 'driver', 'index', 'ledger', 'meta_id']} + return {key: value for key, value in vars(self).items() if key not in ['table', 'driver', 'index', 'ledger', 'meta_id', 'strands']} def save(self): """Save the current value of the `innoldb.qldb.Document` fields to the **QLDB** ledger table.