-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document
dj.Top()
and add missing pages
- Loading branch information
1 parent
eef7e59
commit 2f7bbe6
Showing
14 changed files
with
1,253 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 +1,53 @@ | ||
# Altering Populated Pipelines | ||
|
||
Tables can be altered after they have been declared and populated. This is useful when | ||
you want to add new secondary attributes or change the data type of existing attributes. | ||
Users can use the `definition` property to update a table's attributes and then use | ||
`alter` to apply the changes in the database. Currently, `alter` does not support | ||
changes to primary key attributes. | ||
|
||
Let's say we have a table `Student` with the following attributes: | ||
|
||
```python | ||
@schema | ||
class Student(dj.Manual): | ||
definition = """ | ||
student_id: int | ||
--- | ||
first_name: varchar(40) | ||
last_name: varchar(40) | ||
home_address: varchar(100) | ||
""" | ||
``` | ||
|
||
We can modify the table to include a new attribute `email`: | ||
|
||
```python | ||
Student.definition = """ | ||
student_id: int | ||
--- | ||
first_name: varchar(40) | ||
last_name: varchar(40) | ||
home_address: varchar(100) | ||
email: varchar(100) | ||
""" | ||
Student.alter() | ||
``` | ||
|
||
The `alter` method will update the table in the database to include the new attribute | ||
`email` added by the user in the table's `definition` property. | ||
|
||
Similarly, you can modify the data type or length of an existing attribute. For example, | ||
to alter the `home_address` attribute to have a length of 200 characters: | ||
|
||
```python | ||
Student.definition = """ | ||
student_id: int | ||
--- | ||
first_name: varchar(40) | ||
last_name: varchar(40) | ||
home_address: varchar(200) | ||
email: varchar(100) | ||
""" | ||
Student.alter() | ||
``` |
This file contains 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 +1,26 @@ | ||
# Work in progress | ||
# Overview | ||
|
||
DataJoint provides functionality for serializing and deserializing complex data types | ||
into binary blobs for efficient storage and compatibility with MATLAB's mYm | ||
serialization. This includes support for: | ||
|
||
+ Basic Python data types (e.g., integers, floats, strings, dictionaries). | ||
+ NumPy arrays and scalars. | ||
+ Specialized data types like UUIDs, decimals, and datetime objects. | ||
|
||
## Serialization and Deserialization Process | ||
|
||
Serialization converts Python objects into a binary representation for efficient storage | ||
within the database. Deserialization converts the binary representation back into the | ||
original Python object. | ||
|
||
Blobs over 1 KiB are compressed using the zlib library to reduce storage requirements. | ||
|
||
## Supported Data Types | ||
|
||
DataJoint supports the following data types for serialization: | ||
|
||
+ Scalars: Integers, floats, booleans, strings. | ||
+ Collections: Lists, tuples, sets, dictionaries. | ||
+ NumPy: Arrays, structured arrays, and scalars. | ||
+ Custom Types: UUIDs, decimals, datetime objects, MATLAB cell and struct arrays. |
This file contains 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 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 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 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
Oops, something went wrong.