Skip to content

Commit 34c51d0

Browse files
Merge pull request #261 from ixcat/issue-199
add example to `Creating a virtual class` docs #199
2 parents 072454f + e5d9852 commit 34c51d0

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

docs-parts/existing/1-Loading-Classes_lang1.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22
Creating a virtual class
33
~~~~~~~~~~~~~~~~~~~~~~~~
44

5-
A ``TableAccessor`` object is created as a property of a schema during each schema's creation.
6-
This property is named ``schema.v``, for *virtual class generator*.
7-
The ``TableAccessor`` ``v`` itself has properties that refer to the tables of the schema.
8-
For example, one can access the ``Session`` table using ``schema.v.Session`` with no need for any ``Session`` class to exist in MATLAB.
9-
Tab completion of table names is possible because the table names are added as dynamic properties of ``TableAccessor``.
5+
To facilitate working with existing pipelines, DataJoint MATLAB creates a ``TableAccessor`` property in each schema object.
6+
The ``TableAccessor`` property, a *virtual class generator*, is available as ``schema.v``, and allows listing and querying of the tables defined on the server without needing to create the MATLAB table definitions locally.
7+
For example, creating a scratch ``experiment`` schema package and querying an existing ``my_experiment.Session`` table on the server can be done as follows:
8+
9+
.. code-block:: matlab
10+
11+
dj.createSchema('experiment', '/scratch', 'my_experiment')
12+
addpath('/scratch')
13+
experiment_schema = experiment.getSchema();
14+
experiment_schema.v.Session() & 'session_id=1234';
15+
16+
.. note::
17+
18+
You can view the available tables in a schema by using tab completion on the ``schema.v`` property.

0 commit comments

Comments
 (0)