You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-8Lines changed: 53 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,18 @@
1
+
[Credentials](#cred)
2
+
1
3
# 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
3
16
4
17
# Installation
5
18
To install, simply use `pip`:
@@ -15,7 +28,7 @@ As of v0.4.0 this API no longer supports using a ``.labkeycredentials.txt`` file
15
28
16
29
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.
17
30
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.
19
32
20
33
In that directory, create a text file with the prefix appropriate to your system, either an underscore or dot.
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
result = select_rows(server_context, schema, table)
80
+
if result isnotNone:
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)
38
85
```
39
86
40
87
# Supported Versions
41
88
Python 2.6+ and 3.4+ are fully supported.
42
-
43
89
LabKey Server v13.3 and later.
44
90
45
91
# Contributing
46
92
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).
0 commit comments