-
Notifications
You must be signed in to change notification settings - Fork 90
Documentation content additions and revisions for M2 #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 31 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
46889f0
Fix subtitle marker in Creating Tables.
austin-hilberg 99a9019
Merge branch 'master' of https://github.com/datajoint/datajoint-python
austin-hilberg 3e74a31
Add Python sections for Key Source.
austin-hilberg 9fcf61a
Shuffle non-lang-spec content in Drop.
austin-hilberg 7f9e5dd
Shuffle non-lang-spec content in Delete.
austin-hilberg d411ca7
Fix syntax in Universal Sets .aggr statements.
austin-hilberg 2767613
Fix syntax in Aggr.
austin-hilberg 0baa7ac
Reorder Restriction sections. Fix/add Python examples.
austin-hilberg d615baa
Add lang-spec Restriction portion. Shift filenames.
austin-hilberg e625e17
Add Python examples of restriction by string.
austin-hilberg c288b48
Document use with Pandas DataFrames in Insert, Fetch, and Restriction.
austin-hilberg e1c74c4
Add example of server-side inserts.
austin-hilberg 8b4aaf1
Merge branch 'master' of https://github.com/datajoint/datajoint-python
austin-hilberg 2bf63db
Make Table creation on the database server more concise.
austin-hilberg 7a5f80a
Fix definition string in Creating Tables.
austin-hilberg c1b64a4
Mention returning primary key values along with other attributes as s…
austin-hilberg dbd28e7
Add lang-spec file for Virtual.
austin-hilberg 7760ea6
Add lang-spec content for Virtual.
austin-hilberg cf64196
Add more lang-spec blob-config sections.
austin-hilberg 5dc48a0
Add content for new lang-spec blob-config pages.
austin-hilberg c05cc95
Fix spacing in Virtual.
austin-hilberg 73ebe0e
Merge branch 'master' of https://github.com/datajoint/datajoint-python
austin-hilberg 1de86b7
Add lang-spec page in Populate.
austin-hilberg baa78ae
Move Python content to lang-spec page in Populate.
austin-hilberg f699a33
Move Python content to lang-spec page in Populate.
austin-hilberg 227b0b4
Move Python content to lang-spec file in Progress.
austin-hilberg f46de91
Explain optional insert parameters.
austin-hilberg 359022c
Reword discussion of classes.
austin-hilberg e9d539e
Add lang-spec files for Join.
austin-hilberg bedd06c
Remove lang-spec files for Join.
austin-hilberg 1bd2fca
Fix indentation and edit blob config lang2.
austin-hilberg 69fcb46
Update docs-parts/existing/1-Virtual-Modules_lang1.rst
dimitri-yatsenko 736a41d
Update docs-parts/existing/1-Virtual-Modules_lang1.rst
dimitri-yatsenko 31e52ba
Update docs-parts/existing/1-Virtual-Modules_lang1.rst
dimitri-yatsenko 2f0e884
Update docs-parts/queries/06-Restriction_lang4.rst
dimitri-yatsenko 8e3e790
Update docs-parts/queries/06-Restriction_lang5.rst
dimitri-yatsenko db37e79
Add Integrity lang-spec pages.
austin-hilberg 9e0c432
Remove empty.txt from Concepts.
austin-hilberg 18b1d73
Add lang-spec content for Integrity.
austin-hilberg 9d784bd
Fix cache folder section.
austin-hilberg 71abc6e
Provide example of cache setting.
austin-hilberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| .. code-block:: python | ||
|
|
||
| >>> schema.external_table.delete_garbage() | ||
| Use ``dj.config`` for configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| .. code-block:: python | ||
| >>> schema.external_table.clean_store('external-name') | ||
| This is done using the ``set_cache_folder`` method of the schema object. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .. code-block:: python | ||
|
|
||
| >>> schema.external_table.delete_garbage() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .. code-block:: python | ||
|
|
||
| >>> schema.external_table.clean_store('external-name') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| The ``populate`` method accepts a number of optional arguments that provide more features and allow greater control over the method's behavior. | ||
|
|
||
| - ``restrictions`` - A list of restrictions, restricting as ``(tab.key_source & AndList(restrictions)) - tab.proj()``. | ||
| Here ``target`` is the table to be populated, usually ``tab`` itself. | ||
| - ``suppress_errors`` - If ``True``, encountering an error will cancel the current ``make`` call, log the error, and continue to the next ``make`` call. | ||
| Error messages will be logged in the job reservation table (if ``reserve_jobs`` is ``True``) and returned as a list. | ||
| See also ``return_exception_objects`` and ``reserve_jobs``. | ||
| Defaults to ``False``. | ||
| - ``return_exception_objects`` - If ``True``, error objects are returned instead of error messages. | ||
| This applies only when ``suppress_errors`` is ``True``. | ||
| Defaults to ``False``. | ||
| - ``reserve_jobs`` - If ``True``, reserves job to indicate to other distributed processes. | ||
| The job reservation table may be access as ``schema.jobs``. | ||
| Errors are logged in the jobs table. | ||
| Defaults to ``False``. | ||
| - ``order`` - The order of execution, either ``"original"``, ``"reverse"``, or ``"random"``. | ||
| Defaults to ``"original"``. | ||
| - ``display_progress`` - If ``True``, displays a progress bar. | ||
| Defaults to ``False``. | ||
| - ``limit`` - If not ``None``, checks at most this number of keys. | ||
| Defaults to ``None``. | ||
| - ``max_calls`` - If not ``None``, populates at most this many keys. | ||
| Defaults to ``None``, which means no limit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| The method ``table.progress`` reports how many ``key_source`` entries have been populated and how many remain. | ||
| Two optional parameters allow more advanced use of the method. | ||
| A parameter of restriction conditions can be provided, specifying which entities to consider. | ||
| A Boolean parameter ``display`` (default is ``True``) allows disabling the output, such that the numbers of remaining and total entities are returned but not printed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| A custom key source can be configured by setting the ``key_source`` property within a table class, after the ``definition`` string. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .. code-block:: python | ||
| @schema | ||
| class EEG(dj.Imported): | ||
| definition = """ | ||
| -> Recording | ||
| --- | ||
| sample_rate : float | ||
| eeg_data : longblob | ||
| """ | ||
| key_source = Recording & 'recording_type = "EEG"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| The table is created at the time of the class definition. | ||
| In fact, it is one of the jobs performed by the decorator ``@schema`` of the class. | ||
| Users do not need to do anything special to have a table created in the database. | ||
| Tables are created at the time of class definition. | ||
| In fact, table creation on the database is one of the jobs performed by the decorator ``@schema`` of the class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,4 @@ | ||
|
|
||
| Dropping part tables | ||
| -------------------- | ||
|
|
||
| A :ref:`part table <master-part>` is usually removed as a consequence of calling ``drop`` on its master table. | ||
| To enforce this workflow, calling ``drop`` directly on a part table produces an error. | ||
| In some cases, it may be necessary to override this behavior. | ||
| To remove a part table without removing its master, use the argument ``force=True``. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| The function ``create_virtual_module`` of the ``dj.schema`` class provides access to virtual modules. | ||
| It creates a python module with the given name from the name of a schema on the server, automatically adds classes to it corresponding to the tables in the schema. | ||
|
|
||
| The function can take several parameters: | ||
|
|
||
| ``module_name``: displayed module name. | ||
|
|
||
| ``schema_name``: name of the database in MySQL. | ||
|
|
||
| ``create_schema``: if ``True``, create the schema on the database server. | ||
austin-hilberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ``create_tables``: if ``True``, ``module.schema`` can be used as the decorator for declaring new classes. | ||
austin-hilberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The function returns the Python module containing classes from the schema object as well as the table classes. | ||
austin-hilberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
|
|
||
| .. code-block:: python | ||
| # Server-side inserts are faster... | ||
| phase_two.Protocol.insert(phase_one.Protocol) | ||
| # ...than fetching before inserting | ||
| protocols = phase_one.Protocol.fetch() | ||
| phase_two.Protocol.insert(protocols) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
|
|
||
| Entities in a :ref:`part table <master-part>` are usually removed as a consequence of calling ``delete`` on the master table. | ||
| To enforce this workflow, calling ``delete`` directly on a part table produces an error. | ||
| In some cases, it may be necessary to override this behavior. | ||
| To remove entities from a part table without calling ``delete`` master, use the argument ``force=True``. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
|
|
||
| * another table | ||
| * a query expression | ||
| * a mapping, e.g. ``dict`` | ||
| * an expression in a character string | ||
| * a collection of conditions as a ``list`` or ``tuple`` | ||
| * a collection of conditions as a ``list``, ``tuple``, or Pandas ``DataFrame`` | ||
| * a Boolean expression (``True`` or ``False``) | ||
| * an ``AndList`` | ||
| * a ``Not`` object | ||
|
|
||
| * a query expression |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
|
|
||
| A collection can be a list or tuple. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| # a list: | ||
| cond_list = ['first_name = "Aaron"', 'last_name = "Aaronson"'] | ||
| # All the sessions performed by Alice | ||
| Session & 'user = "Alice"' | ||
|
|
||
| # a tuple: | ||
| cond_tuple = ('first_name = "Aaron"', 'last_name = "Aaronson"') | ||
| # All the experiments at least one minute long | ||
| Experiment & 'duration >= 60' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
|
|
||
| .. code-block:: python | ||
| A collection can be a list, a tuple, or a Pandas ``DataFrame``. | ||
|
|
||
| Student() & ['first_name = "Aaron"', 'last_name = "Aaronson"'] | ||
| .. code-block:: python | ||
| .. figure:: ../_static/img/python_collection.png | ||
| :align: center | ||
| :alt: restriction by collection | ||
| # a list: | ||
| cond_list = ['first_name = "Aaron"', 'last_name = "Aaronson"'] | ||
| Restriction by a collection, returning any entities matching any condition in the collection. | ||
| # a tuple: | ||
| cond_tuple = ('first_name = "Aaron"', 'last_name = "Aaronson"') | ||
| # a dataframe: | ||
| import pandas as pd | ||
| cond_frame = pd.DataFrame(tab.fetch()) | ||
austin-hilberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,11 @@ | ||
|
|
||
| ``A & True`` and ``A - False`` are equivalent to ``A``. | ||
| ``A & False`` and ``A - True`` are empty. | ||
| .. code-block:: python | ||
| Student() & ['first_name = "Aaron"', 'last_name = "Aaronson"'] | ||
| .. figure:: ../_static/img/python_collection.png | ||
| :align: center | ||
| :alt: restriction by collection | ||
|
|
||
| Restriction by a collection, returning any entities matching any condition in the collection. | ||
austin-hilberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,4 @@ | ||
|
|
||
| Restriction by an ``AndList`` | ||
| ----------------------------- | ||
|
|
||
| The special function ``dj.AndList`` represents logical conjunction (logical AND). | ||
| Restriction of table ``A`` by an ``AndList`` will return all entities in ``A`` that meet *all* of the conditions in the list. | ||
| ``A & dj.AndList([c1, c2, c3])`` is equivalent to ``A & c1 & c2 & c3``. | ||
| Usually, it is more convenient to simply write out all of the conditions, as ``A & c1 & c2 & c3``. | ||
| However, when a list of conditions has already been generated, the list can simply be passed as the argument to ``dj.AndList``. | ||
|
|
||
| Restriction of table ``A`` by an empty ``AndList``, as in ``A & dj.AndList([])``, will return all of the entities in ``A``. | ||
| Exclusion by an empty ``AndList`` will return no entities. | ||
|
|
||
| Restriction by a ``Not`` object | ||
| ------------------------------- | ||
|
|
||
| The special function ``dj.Not`` represents logical negation, such that ``A & dj.Not(cond)`` is equivalent to ``A - cond``. | ||
| ``A & True`` and ``A - False`` are equivalent to ``A``. | ||
|
|
||
| ``A & False`` and ``A - True`` are empty. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
|
|
||
| Restriction by an ``AndList`` | ||
| ----------------------------- | ||
|
|
||
| The special function ``dj.AndList`` represents logical conjunction (logical AND). | ||
| Restriction of table ``A`` by an ``AndList`` will return all entities in ``A`` that meet *all* of the conditions in the list. | ||
| ``A & dj.AndList([c1, c2, c3])`` is equivalent to ``A & c1 & c2 & c3``. | ||
| Usually, it is more convenient to simply write out all of the conditions, as ``A & c1 & c2 & c3``. | ||
| However, when a list of conditions has already been generated, the list can simply be passed as the argument to ``dj.AndList``. | ||
|
|
||
| Restriction of table ``A`` by an empty ``AndList``, as in ``A & dj.AndList([])``, will return all of the entities in ``A``. | ||
| Exclusion by an empty ``AndList`` will return no entities. | ||
|
|
||
| Restriction by a ``Not`` object | ||
| ------------------------------- | ||
|
|
||
| The special function ``dj.Not`` represents logical negation, such that ``A & dj.Not(cond)`` is equivalent to ``A - cond``. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .. code-block:: python | ||
|
|
||
| query = Session & 'user = "Alice"' | ||
| Experiment & query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.