Skip to content

Commit

Permalink
add interfaces slides
Browse files Browse the repository at this point in the history
  • Loading branch information
sob05001 committed Feb 5, 2025
1 parent 01a89bc commit 53fe875
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 8 deletions.
257 changes: 252 additions & 5 deletions dms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3203,7 +3203,9 @@ <h5>What is a Admin Tool Interface?</h5>
<h5>Today: February 5, 2025</h5>
<ul>
<li>Introduction PostgreSQL</li>
<li>Relational Database Interfaces</li>
<li>Relational Database Admin Interfaces</li>
<li>Relational Database Developer Interfaces</li>
<li>Relational Database User Interfaces</li>
<li>Practice Questions</li>
<li>Homework 2, Lab 2, Project Part 1</li>
</ul>
Expand All @@ -3215,7 +3217,8 @@ <h5>PostgreSQL: An Introduction</h5>
<li><strong>What is PostgreSQL?</strong> Open-source, enterprise-class relational database</li>
<li><strong>License:</strong> PostgreSQL License (permissive open-source)</li>
<li><strong>ACID Compliance:</strong> Ensures data integrity</li>
<li><strong>Extensibility:</strong> Supports custom functions and data types</li>
<li><strong>Extensibility:</strong> <span class="highlight">Supports custom functions and data types</span>
</li>
<li><strong>Advanced Features:</strong> JSON, full-text search, geospatial support</li>
<li><strong>Concurrency Control:</strong> Uses MVCC for efficient transactions</li>
<li><strong>Cross-Platform:</strong> Runs on Linux, Windows, macOS, and cloud</li>
Expand All @@ -3229,7 +3232,7 @@ <h5>PostgreSQL: A Timeline</h5>
<li><strong>1986:</strong> Developed at UC Berkeley by Michael Stonebraker</li>
<li><strong>1989:</strong> POSTGRES 1.0 released</li>
<li><strong>1994:</strong> Renamed to PostgreSQL</li>
<li><strong>1996:</strong> Open-source development begins</li>
<li><strong>1996:</strong> <span class="highlight">Open-source</span> development begins</li>
<li><strong>2000:</strong> MVCC introduced in PostgreSQL 7.0</li>
<li><strong>2005:</strong> Native Windows support added</li>
<li><strong>2010:</strong> Streaming replication introduced</li>
Expand All @@ -3239,21 +3242,265 @@ <h5>PostgreSQL: A Timeline</h5>
</ul>
</section>

<section>
<h5>PostgreSQL: Open Source License Requirements</h5>
<table border="1">
<tr>
<th>Database</th>
<th>License</th>
<th>Restrictions</th>
</tr>
<tr>
<td>SQLite</td>
<td>Public Domain</td>
<td>No restrictions, free for any use</td>
</tr>
<tr>
<td>PostgreSQL</td>
<td>PostgreSQL License (BSD-style)</td>
<td>Requires keeping copyright notice</td>
</tr>
</table>
</section>

<section>
<h5>PostgreSQL License Notice</h5>
<pre>
PostgreSQL Database Management System
Copyright (c) 1996-2024, The PostgreSQL Global Development Group

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written
agreement is hereby granted, provided that the above copyright notice
and this paragraph appear in all copies.

IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</pre>
</section>

<section>
<h5>Why Was PostgreSQL Invented?</h5>
<ul>
<li><strong>Ingres Limitations:</strong> Lacked extensibility and support for complex data types</li>
<li><strong>Ingres Limitations:</strong> <span class="highlight"> Lacked extensibility and support for
complex data types</span></li>
<li><strong>Advanced Data Needs:</strong> Required better handling of objects and relationships</li>
<li><strong>Scalability:</strong> Needed a more flexible and efficient query engine</li>
<li><strong>ACID Compliance:</strong> Improved transaction reliability and consistency</li>
<li><strong>Open-Source Model:</strong> Encouraged community contributions and innovation</li>
</ul>
</section>
</section>

<section>
<p><a href="https://www.postgresql.org/about/featurematrix/" target="_blank">PostgreSQL Feature Matrix</a></p>
</section>

<section>
<h5>PostgreSQL Query Transformer</h5>
<p><a href="https://github.com/postgres/postgres/blob/master/src/backend/parser/analyze.c#L1427"
target="_blank">View Code</a></p>
</section>

<section>
<h5>Relational Database Admin Interfaces</h5>
</section>

<section>
<h5>Neon Database Admin Functions</h5>
<ul>
<li><b>Database Management</b> – Create, delete, and manage databases</li>
<li><b>Branching</b> – Instantly create database branches for development and testing</li>
<li><b>Connection Monitoring</b> – View active connections and resource usage</li>
<li><b>Role & Access Control</b> – Manage user roles and permissions</li>
<li><b>Performance Insights</b> – Analyze query performance and optimize execution</li>
</ul>
</section>

<section>
<a href="https://console.neon.tech/app/" target="_blank">Neon Database Console</a>
</section>

<section>
<h5>pg_stat_statements</h5>
<ul>
<li>Tracks execution statistics of SQL queries</li>
<li>Records query text, execution time, and I/O stats</li>
<li>Helps identify slow or expensive queries</li>
<li>Requires the pg_stat_statements extension</li>
<li>Useful for database performance tuning</li>
</ul>
</section>

<section>
<h5>Questions?</h5>
</section>

<section>
<h5>Task 1: Creating a Database Backup</h5>
<p>Is this an Admin Task, Developer Task, or User Task?</p>
</section>

<section>
<h5>Task 2: Writing a New API Endpoint</h5>
<p>Is this an Admin Task, Developer Task, or User Task?</p>
</section>

<section>
<h5>Task 3: Managing User Permissions</h5>
<p>Is this an Admin Task, Developer Task, or User Task?</p>
</section>

<section>
<h5>Task 4: Debugging an Application Error</h5>
<p>Is this an Admin Task, Developer Task, or User Task?</p>
</section>

<section>
<h5>Task 5: Updating Software Dependencies</h5>
<p>Is this an Admin Task, Developer Task, or User Task?</p>
</section>

<section>
<h5>Relational Database Developer Interfaces</h5>
</section>

<section data-background="https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"
data-background-opacity=".2">
<h5>Developers: The Bridge</h5>
<ul>
<li>Connect frontend applications to databases</li>
<li>Handle business logic and data processing</li>
<li>Develop APIs for frontend communication</li>
<li>Ensure data security and integrity</li>
<li>Optimize performance between UI and storage</li>
</ul>
</section>

<section>
<h5>Backend to Database Connection</h5>
<ul>
<li>Uses API key for authentication</li>
<li>Connects to PostgreSQL database</li>
<li>Ensures secure communication with SSL</li>
</ul>
</section>

<section>
<h5>PostgreSQL API Connection String Breakdown</h5>
<ul>
<li><b>Protocol:</b> postgresql://</li>
<li><b>Username:</b> neondb_owner</li>
<li><b>Password:</b> *********</li>
<li><b>Host:</b> ep-shrill-tree-a819xf7v-pooler.eastus2.azure.neon.tech</li>
<li><b>Database:</b> neondb</li>
<li><b>SSL Mode:</b> require (ensures secure connection)</li>
</ul>
</section>

<section>
<h5>Backend to Frontend via REST API</h5>
<ul>
<li>Exposes endpoints for frontend access</li>
<li>Uses HTTP methods (GET, POST, etc.)</li>
<li>Requires authentication for secure access</li>
</ul>
</section>

<section>
<h5>REST API Request Example</h5>
<pre><code>
@app.route('/flowers')
def manage_flowers():
conn = get_db_connection()
cur = conn.cursor()
cur.execute("SELECT * FROM flowers")
flowers = cur.fetchall()
cur.close()
conn.close()
return render_template('flowers.html', flowers=flowers)
</code></pre>
</section>

<section>
<h5>Task 1: Designing a Database Schema</h5>
<p>Is this a Backend Database Developer Task?</p>
</section>

<section>
<h5>Task 2: Implementing a REST API</h5>
<p>Is this a Backend Database Developer Task?</p>
</section>

<section>
<h5>Task 3: Styling a Web Page</h5>
<p>Is this a Backend Database Developer Task?</p>
</section>

<section>
<h5>PostgreSQL Backend Code Example</h5>
<a href="https://github.com/SE4CPS/DMS/tree/main/database/PostgreSQL" target="_blank">
GitHub: SE4CPS DMS - PostgreSQL
</a>
</section>

<section>
<h5>Questions?</h5>
</section>

<section>
<h5>Relational Database User Interfaces</h5>
</section>

<section>
<h5>Frontend Database-Related Tasks</h5>
<ul>
<li>Fetching data from APIs</li>
<li>Displaying database records in UI</li>
<li>Sending user input to backend</li>
<li>Handling API authentication (e.g., tokens)</li>
<li>Managing client-side caching</li>
<li>Managing client-side validation</li>
</ul>
</section>

<section>
<h5>PostgreSQL Backend Code Example</h5>
<a href="https://github.com/SE4CPS/DMS/tree/main/database/PostgreSQL" target="_blank">
GitHub: SE4CPS DMS - PostgreSQL
</a>
</section>

<section>
<h5>Question 1</h5>
<p>Is fetching data from an API a frontend or backend task?</p>
</section>

<section>
<h5>Question 2</h5>
<p>Who is responsible for validating user input before storing it in the database?</p>
</section>

<section>
<h5>Question 3</h5>
<p>Does the frontend directly modify the database?</p>
</section>

<section>
<h5>Questions?</h5>
</section>

<section>
<h5>Python and GitHub</h5>
</section>

<section>
<h5>Homework 2, Lab 2, Project Part 1</h5>
</section>

<!-- Module 5 -->

<section id="module-5">
<h5>Module 5<br>Relational Database Advanced SQL</h5>
</section>
Expand Down
6 changes: 3 additions & 3 deletions dms/templates/flowers.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<h2>Flower Management</h2>

<form action="/add_flower" method="post">
<input type="text" name="name" placeholder="Flower Name" required>
<input type="text" name="name" placeholder="Flower Name">
<input type="text" name="color" placeholder="Color">
<input type="number" name="price" placeholder="Price" required>
<input type="number" name="stock" placeholder="Stock" required>
<input type="number" name="price" placeholder="Price" >
<input type="number" name="stock" placeholder="Stock" >
<button type="submit">Add Flower</button>
</form>

Expand Down

0 comments on commit 53fe875

Please sign in to comment.