This is no longer maintained and has been superseded by datajoint-company/datajoint-docs. Please file new issues there (or help contribute!). We are currently migrating and generating new content until December 2022 after which we’ll be decomissioning https://docs.datajoint.org and https://tutorials.datajoint.org in favor of https://datajoint.com/docs/.
Install and Connect¶
DataJoint is implemented for Python 3.4+. You may install it from PyPI:
pip3 install datajoint
pip3 install --upgrade datajoint
Next configure the connection through DataJoint’s
In : import datajoint as dj DataJoint 0.4.9 (February 1, 2017) No configuration found. Use `dj.config` to configure and save the configuration.
You may now set the database credentials:
In : dj.config['database.host'] = "alicelab.datajoint.io" In : dj.config['database.user'] = "alice" In : dj.config['database.password'] = "haha not my real password"
Skip setting the password to make DataJoint prompt to enter the password every time.
You may save the configuration in the local work directory with
dj.config.save_local() or for all your projects in
Configuration changes should be made through the
dj.config interface; the config file should not be modified directly by the user.
You may leave the user or the password as
None, in which case you will be prompted to enter them manually for every session.
Setting the password as an empty string allows access without a password.
Note that the system environment variables
DJ_PASS will overwrite the settings in the config file.
You can use them to set the connection credentials instead of config files.
To change the password, the
dj.set_password function will walk you through the process:
After that, update the password in the configuration and save it as described above:
dj.config['database.password'] = 'my#cool!new*psswrd' dj.config.save_local() # or dj.config.save_global()
Other Configuration Settings¶
Starting with v0.12 (Python) and v3.3.1 (MATLAB), DataJoint will by default
use TLS if it is available. TLS can be forced on or off with the boolean
use_tls in MATLAB, or
dj.config['database.use_tls'] in Python.