Skip to content

Commit cbda298

Browse files
committed
Update README.md
First draft of docs for version 0.3.0
1 parent 2baafdb commit cbda298

File tree

1 file changed

+53
-8
lines changed

1 file changed

+53
-8
lines changed

README.md

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
[Credentials](#cred)
2+
13
# About
2-
Python client API for LabKey Server. To get started, please see the [full documentation for this library](https://www.labkey.org/wiki/home/Documentation/page.view?name=python).
4+
The Python client API for LabKey Server lets you query, insert and update data on a LabKey Server from a Python client.
5+
6+
# Release Notes
7+
8+
Changes in the current release:
9+
10+
- Support for Python 3
11+
- Support for netrc files (.labkeycredentials.txt files are now deprecated)
12+
- server_context parameter on all methods
13+
- PEP standards - the latest update follows PEP code styling standards
14+
- New samples
15+
- New methods: load_batch and save_batch
316

417
# Installation
518
To install, simply use `pip`:
@@ -15,7 +28,7 @@ As of v0.4.0 this API no longer supports using a ``.labkeycredentials.txt`` file
1528

1629
On a Mac, UNIX, or Linux system the netrc file should be named ``.netrc`` (dot netrc) and on Windows it should be named ``_netrc`` (underscore netrc). The file should be located in your home directory and the permissions on the file must be set so that you are the only user who can read it, i.e. it is unreadable to everyone else.
1730

18-
To create the netrc on a Windows machine, first create an environment variable called ’HOME’ that is set to your home directory (c:/Users/<User-Name> on Vista or Windows 7) or any directory you want to use.
31+
To create the netrc on a Windows machine, first create an environment variable called ’HOME’ that is set to your home directory (for example, C:/Users/johndoe) or any directory you want to use.
1932

2033
In that directory, create a text file with the prefix appropriate to your system, either an underscore or dot.
2134

@@ -26,22 +39,54 @@ login <user-email>
2639
password <user-password>
2740
```
2841

29-
One example would be:
42+
For example:
3043
```
3144
machine mymachine.labkey.org
3245
login user@labkey.org
3346
password mypassword
3447
```
35-
Another example would be:
36-
```
37-
machine mymachine.labkey.org login user@labkey.org password mypassword
48+
Note that the netrc file only deals with connections at the machine level and should not include a port or protocol designation, meaning both "mymachine.labkey.org:8888" and "https://mymachine.labkey.org" are incorrect.
49+
50+
# Supported Functions
51+
52+
- **labkey.query.select_rows()** - Query and get results sets from LabKey Server.
53+
- **labkey.query.execute_sql()** - Execute SQL (LabKey SQL dialect) through the query module on LabKey Server.
54+
- **labkey.query.insert_rows()** - Insert rows into a table on LabKey Server.
55+
- **labkey.query.update_rows()** - Update rows in a table on LabKey Server.
56+
- **labkey.query.delete_rows()** - Delete records in a table on LabKey Server.
57+
- **labkey.experiment.load_batch()** - Retreive assay data (batch level) from LabKey Server.
58+
- **labkey.experiment.save_batch()** - Save assay data (batch level) on LabKey Server.
59+
60+
# Examples
61+
62+
Sample code is availabe in the [samples](https://github.com/LabKey/labkey-api-python/tree/experiment/samples) directory.
63+
64+
The following gets data from the Users table on your local machine:
65+
66+
```python
67+
from labkey.utils import create_server_context
68+
from labkey.query import select_rows
69+
70+
print("Create a server context")
71+
labkey_server = 'localhost:8080'
72+
project_name = 'ModuleAssayTest' # Project folder name
73+
contextPath = 'labkey'
74+
schema = 'core'
75+
table = 'Users'
76+
77+
server_context = create_server_context(labkey_server, project_name, contextPath, use_ssl=False)
78+
79+
result = select_rows(server_context, schema, table)
80+
if result is not None:
81+
print(result['rows'][0])
82+
print("select_rows: Number of rows returned: " + str(result['rowCount']))
83+
else:
84+
print('select_rows: Failed to load results from ' + schema + '.' + table)
3885
```
3986

4087
# Supported Versions
4188
Python 2.6+ and 3.4+ are fully supported.
42-
4389
LabKey Server v13.3 and later.
4490

4591
# Contributing
4692
This library and the LabKey Server are maintained by the LabKey Software Foundation. If you have any questions or need support, please use the [LabKey Server support forum](https://www.labkey.org/wiki/home/page.view?name=support).
47-

0 commit comments

Comments
 (0)