From c8be69627144c1eb62789911883eb4d5a18b9317 Mon Sep 17 00:00:00 2001 From: sjbrandenberg Date: Sat, 25 Nov 2023 17:51:56 -0800 Subject: [PATCH] Updated NGL documentation (#52) * Add files via upload * Delete docs/brandenberg/apiusecases/output_9_1.png * Delete docs/brandenberg/apiusecases/output_11_1.png * Delete docs/brandenberg/apiusecases/output_7_1.png * Delete docs/brandenberg/apiusecases/output_8_0.png * Update usecase.md * Update usecase.md * Create license.md * Update usecase.md Adjusting heading levels for use cases so they fall under "Implementation" * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md Updating hyperlinks and adding table with links to notebooks * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md * Update usecase.md --------- Co-authored-by: Krishna Kumar <3963513+kks32@users.noreply.github.com> --- docs/brandenberg/usecase.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/brandenberg/usecase.md b/docs/brandenberg/usecase.md index 313b02c7..dd48627e 100644 --- a/docs/brandenberg/usecase.md +++ b/docs/brandenberg/usecase.md @@ -45,10 +45,10 @@ The example makes use of the following DesignSafe resources: - Direct Simple Shear Viewer + Laboratory Test Viewer - + @@ -109,11 +109,18 @@ This documentation first demonstrates how to install the database connection scr ## Installing Database Connection Script Connecting to a relational database requires credentials, like username, password, database name, and hostname. -Rather than requiring users to know these credentials and create their own database connections, we have created a Python package that allows users to -query the database. This code installs the package containing the database connection script for NGL: +Rather than requiring users to know these credentials and create their own database connections, we have created a Python package that allows users to query the database. This code installs the package containing the database connection script for NGL: ```python -!pip install git+https://github.com/sjbrandenberg/designsafe_db +!pip install dsdatabase +``` + +The connection script can then be invoked by creating an object from the DSDatabase class corresponding to the "ngl" connection, and submitting a query using the ngl.read_sql(sql) function. + +```python +from dsdatabase.db import DSDatabase +ngl = DSDatabase("ngl") +df = ngl.read_sql(sql) ``` ## Example Queries