Skip to content

Commit b792de5

Browse files
Refactor orm into odm 'Object Data Mapper'
2 parents b79ed94 + 07995c7 commit b792de5

26 files changed

+76
-76
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,15 +637,15 @@ print(type(resp)) # <class 'Neo4jResponse'>
637637

638638
```
639639

640-
### ORM (Object-relational mapping)
641-
For each type of NOSQL database there is an _ORM (Object-relational mapping)_ module that contains classes and functions relating to the mapping of
640+
### ODM (Object-Data Mapping)
641+
For each type of NOSQL database there is an _ODM (Object-relational mapping)_ module that contains classes and functions relating to the mapping of
642642
objects and/or operations concerning the specific database _CRUD operation_.
643643

644-
In the `nosqlapi.common.orm` module there are also classes that represent the data types of databases.
644+
In the `nosqlapi.common.odm` module there are also classes that represent the data types of databases.
645645

646646
```pycon
647-
>>> import nosqlapi.common.orm
648-
>>> [t for t in dir(nosqlapi.common.orm) if not t.startswith('__')]
647+
>>> import nosqlapi.common.odm
648+
>>> [t for t in dir(nosqlapi.common.odm) if not t.startswith('__')]
649649
['Array', 'Ascii', 'Blob', 'Boolean', 'Counter', 'Date', 'Dc', 'Decimal', 'Double', 'Duration', 'Float', 'Inet', 'Int',
650650
'List', 'Map', 'Null', 'SmallInt', 'Text', 'Time', 'Timestamp', 'Uuid', 'Varchar']
651651
```

__info__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
"""Information variable used by modules on this package."""
2424

25-
__version__ = '1.0.0'
25+
__version__ = '1.0.1'
2626
__author__ = 'Matteo Guadrini'
2727
__email__ = '[email protected]'
2828
__homepage__ = 'https://github.com/MatteoGuadrini/nosqlapi'

docs/source/build.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Let's prepare the steps:
1919

2020
* Create a package (directory with an ``__init__.py`` file) named **pycouch**.
2121
* write ``core.py``, with core classes and functions.
22-
* write ``utils.py``, with utility classes and function, like ORM objects.
22+
* write ``utils.py``, with utility classes and function, like ODM objects.
2323

2424
Core
2525
----
@@ -648,7 +648,7 @@ Utils
648648
-----
649649

650650
The **utils** classes and functions they map objects that represent data on the CouchDB server.
651-
These types of objects are called *ORMs*.
651+
These types of objects are called *ODMs*.
652652

653653
Create a ``utils.py`` module.
654654

@@ -678,7 +678,7 @@ We will call it ``connect()``.
678678
database=None, ca_cert=None, ca_bundle=None)
679679
return conn.connect()
680680
681-
ORM classes
681+
ODM classes
682682
***********
683683

684684
Now let's define a ``DesignDocument`` class, which will represent a design document in the CouchDB server.
@@ -719,7 +719,7 @@ Now let's define a ``PermissionDocument`` class, which will represent a permissi
719719
self['members'] = {"names": [], "roles": []} if not members else members
720720
721721
.. note::
722-
Now that we have defined some classes that represent documents, we can adapt our methods of the Session class around these ORM types.
722+
Now that we have defined some classes that represent documents, we can adapt our methods of the Session class around these ODM types.
723723

724724
If you want to see more examples, clone the official repository of ``nosqlapi`` and find in the *tests* folder all the examples for each type of database.
725725

docs/source/nosqlapi_column.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
nosqlapi column
44
===============
55

6-
In this package we find abstract classes and ORM classes concerning the **column** database types.
6+
In this package we find abstract classes and ODM classes concerning the **column** database types.
77

88
client module
99
-------------
@@ -48,17 +48,17 @@ This is an example of a library for connecting to a `cassandra <https://cassandr
4848
sess = conn.connect() # Session object
4949
...
5050
51-
orm module
51+
odm module
5252
----------
5353
54-
The **orm** module contains the specific object for *column* databases.
54+
The **odm** module contains the specific object for *column* databases.
5555
56-
.. automodule:: nosqlapi.columndb.orm
56+
.. automodule:: nosqlapi.columndb.odm
5757
:members:
5858
:special-members:
5959
:show-inheritance:
6060
61-
orm example
61+
odm example
6262
***********
6363
6464
These objects represent the respective *column* in databases.
@@ -68,7 +68,7 @@ These objects represent the respective *column* in databases.
6868
import nosqlapi
6969
import mycolumndb
7070
71-
keyspace = nosqlapi.columndb.orm.Keyspace('new_db') # in short -> nosqlapi.columndb.Keyspace('new_db')
71+
keyspace = nosqlapi.columndb.odm.Keyspace('new_db') # in short -> nosqlapi.columndb.Keyspace('new_db')
7272
# Make columns
7373
id = nosqlapi.columndb.Column('id', of_type=int)
7474
id.auto_increment = True # increment automatically

docs/source/nosqlapi_common.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
nosqlapi common
44
===============
55

6-
In this package you will find the modules that contain common interfaces and `ORMs <https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_
7-
(Object-relational mapping), shared by all four types of NOSQL database.
6+
In this package you will find the modules that contain common interfaces and `ODMs <https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_
7+
(Object-Data Mapping), shared by all four types of NOSQL database.
88

99
core module
1010
-----------
@@ -77,21 +77,21 @@ The exceptions stated in this form are used in certain circumstances. See the `t
7777
raise nosqlapi.UnknownError('in short')
7878
7979
80-
orm module
80+
odm module
8181
----------
8282

83-
In the **orm** module, we find generic classes represent real objects present in various NOSQL databases.
83+
In the **odm** module, we find generic classes represent real objects present in various NOSQL databases.
8484

8585
.. note::
8686
These objects are not mandatory for the implementation of their own NOSQL module.
8787
Rather they serve to help the end user have some consistency in python.
8888

89-
.. automodule:: nosqlapi.common.orm
89+
.. automodule:: nosqlapi.common.odm
9090
:members:
9191
:special-members:
9292
:show-inheritance:
9393

94-
orm example
94+
odm example
9595
***********
9696

9797
The classes within the module are python representations of real objects in the database.
@@ -100,7 +100,7 @@ The classes within the module are python representations of real objects in the
100100
101101
import nosqlapi
102102
103-
null = nosqlapi.common.orm.Null() # compare with null object into database
103+
null = nosqlapi.common.odm.Null() # compare with null object into database
104104
null = nosqlapi.Null() # in short
105105
map_ = nosqlapi.Map() # like dict
106106
inet = nosqlapi.Inet('192.168.1.1') # ipv4/ipv6 addresses

docs/source/nosqlapi_doc.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
nosqlapi document
44
=================
55

6-
In this package we find abstract classes and ORM classes concerning the **document** database types.
6+
In this package we find abstract classes and ODM classes concerning the **document** database types.
77

88
client module
99
-------------
@@ -49,17 +49,17 @@ This is an example of a library for connecting to a `mongodb <https://www.mongod
4949
sess = conn.connect() # Session object
5050
...
5151
52-
orm module
52+
odm module
5353
----------
5454

55-
The **orm** module contains the specific object for *document* databases.
55+
The **odm** module contains the specific object for *document* databases.
5656

57-
.. automodule:: nosqlapi.docdb.orm
57+
.. automodule:: nosqlapi.docdb.odm
5858
:members:
5959
:special-members:
6060
:show-inheritance:
6161

62-
orm example
62+
odm example
6363
***********
6464

6565
These objects represent the respective *document* in databases.
@@ -70,7 +70,7 @@ These objects represent the respective *document* in databases.
7070
import mydocdb
7171
7272
# Create database
73-
db = nosqlapi.docdb.orm.Database('test')
73+
db = nosqlapi.docdb.odm.Database('test')
7474
# Create documents
7575
doc1 = nosqlapi.docdb.Document(oid=1)
7676
doc2 = nosqlapi.docdb.Document(oid=2)

docs/source/nosqlapi_graph.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
nosqlapi graph
44
==============
55

6-
In this package we find abstract classes and ORM classes concerning the **graph** database types.
6+
In this package we find abstract classes and ODM classes concerning the **graph** database types.
77

88
client module
99
-------------
@@ -48,17 +48,17 @@ This is an example of a library for connecting to a `neo4j <https://neo4j.com/>`
4848
sess = conn.connect() # Session object
4949
...
5050
51-
orm module
51+
odm module
5252
----------
5353

54-
The **orm** module contains the specific object for *graph* databases.
54+
The **odm** module contains the specific object for *graph* databases.
5555

56-
.. automodule:: nosqlapi.graphdb.orm
56+
.. automodule:: nosqlapi.graphdb.odm
5757
:members:
5858
:special-members:
5959
:show-inheritance:
6060

61-
orm example
61+
odm example
6262
***********
6363

6464
These objects represent the respective *graph* in databases.
@@ -69,7 +69,7 @@ These objects represent the respective *graph* in databases.
6969
import mygraphdb
7070
7171
# Create database
72-
db = nosqlapi.graphdb.orm.Database('test')
72+
db = nosqlapi.graphdb.odm.Database('test')
7373
# Create nodes
7474
node1 = nosqlapi.graphdb.Node(var='n1', labels=[nosqlapi.graphdb.Label('Person')],
7575
properties=nosqlapi.graphdb.Property({'name': 'Matteo', 'age': 35}))

docs/source/nosqlapi_kv.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
nosqlapi key-value
44
==================
55

6-
In this package we find abstract classes and ORM classes concerning the **Key-Value** database types.
6+
In this package we find abstract classes and ODM classes concerning the **Key-Value** database types.
77

88
client module
99
-------------
@@ -49,17 +49,17 @@ This is an example of a library for connecting to a `redis <https://redis.io/>`_
4949
sess = conn.connect() # Session object
5050
...
5151
52-
orm module
52+
odm module
5353
----------
5454

55-
The **orm** module contains the specific object for *key-value* databases.
55+
The **odm** module contains the specific object for *key-value* databases.
5656

57-
.. automodule:: nosqlapi.kvdb.orm
57+
.. automodule:: nosqlapi.kvdb.odm
5858
:members:
5959
:special-members:
6060
:show-inheritance:
6161

62-
orm example
62+
odm example
6363
***********
6464

6565
These objects represent the respective *key-value* in databases.
@@ -68,7 +68,7 @@ These objects represent the respective *key-value* in databases.
6868
6969
import nosqlapi
7070
71-
transaction = nosqlapi.kvdb.orm.Transaction() # in short -> nosqlapi.kvdb.Transaction()
71+
transaction = nosqlapi.kvdb.odm.Transaction() # in short -> nosqlapi.kvdb.Transaction()
7272
# Add commands
7373
transaction.add('ACL LIST')
7474
transaction.add('ACL DELUSER test')

nosqlapi/columndb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
"""Package column NOSQL database."""
2424

2525
from nosqlapi.columndb.client import ColumnConnection, ColumnSelector, ColumnSession, ColumnResponse, ColumnBatch
26-
from nosqlapi.columndb.orm import Keyspace, Table, Column, Index, column
26+
from nosqlapi.columndb.odm import Keyspace, Table, Column, Index, column

nosqlapi/columndb/orm.py renamed to nosqlapi/columndb/odm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# vim: se ts=4 et syn=python:
44

55
# created by: matteo.guadrini
6-
# orm -- nosqlapi
6+
# odm -- nosqlapi
77
#
88
# Copyright (C) 2022 Matteo Guadrini <[email protected]>
99
#
@@ -20,14 +20,14 @@
2020
# You should have received a copy of the GNU General Public License
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

23-
"""ORM module for column NOSQL database."""
23+
"""ODM module for column NOSQL database."""
2424

2525
# region Imports
2626
from collections import namedtuple
2727
from functools import wraps
2828

2929
from nosqlapi.common import Counter
30-
from nosqlapi.kvdb.orm import Keyspace as Ks
30+
from nosqlapi.kvdb.odm import Keyspace as Ks
3131

3232
# endregion
3333

0 commit comments

Comments
 (0)