Trying to share some code ideas

logo

Tag: SQL Page 1 of 3

Streamlit Table Editor App

CRUD (Create, Read, Update, and Delete) it is the cornerstone of working with database applications. Today I will walk through using the Streamlit python framework to build a web based app that you can use to interact with a database. The app will allow you to Read, Update, and Delete tables in your database.

The creators of Streamlit framework have taken care of a large amount of the burden of creating a web based app. However not all of the widgets are feature complete. Streamlit is an asynchronous framework allowing 100s or 1000s of users to use your app. With CRUD operations that is great for the Create and Read, but for Update and Delete, not so much.

Today’s tutorial will show you how to overcome those limitations and hopefully inspire you on how you could use Streamlit for your own apps.

All of the code is available on my Github page, please use responsibly.

NOTE: The code presented is not production ready; i.e. no Exception blocks but it wouldn’t take much more effort to adapt the code to be production ready. Instead we will concentrate on the important parts and get you downloading files quickly. Let’s start the tutorial below.


Pages

  1. Main Page
  2. Files
  3. pages
  4. Streamlit Handler Class
  5. Data Handler Class
  6. PandasSqlHandler
  7. Configuration Files
  8. Query
    1. info.columns
    2. sys.row_count
    3. Table Query – Example
  9. Github Files

Temporal Tables

Where we are going, we need to keep track of the history in the tables.

How to set up and use Temporal Tables in Microsoft SQL Microsoft SQL has native support for keeping track of Insert / Update / Delete from system versioned tables. The following explains how to set up and use temporal tables in Microsoft SQL.

Foreign Key List

Query to show foreign keys for specified table and or column

Search Value in Multiple Columns

Where is it? WHERE IS IT? WHERE????

Sometimes you need to search for a value in the table, but you have no idea where it is. The query will use a cursor allowing you to search through multiple tables and multiple columns to find the value.

Date Format List

Stop searching the web for date formats, query the database

Michael M.

Simple query to show you all the date time formats in the database.

Code for View

Show the DDL Code for a View

Check Login Security

Show the user’s login security

Column Names by Table with Row Counts

How big is it? Big? Really Big? Ginormous???

Yesterday, I posted a quick query Column Names by Table on how to search for a column in any table in the database. Today’s query will extend that functionality to let you know how many rows are in the table while avoiding the dreaded

SELECT   COUNT(*)   FROM dbo.SuperHugeTable;

Column Names by Table

Where is it? Seriously, where is it?

We’ve all had the experience of trying to locate a specific column name or wanting to see the meta-data for columns in a specific or multiple tables. By reading the information schema tables we can see the meta-data and find all occurences of the column in the database. This information can be quite useful when needing to join columns and finding some hidden relationships.

Add a Space Before Upper Case Letter

“Why doesn’t this function exist?”

We have all had the situation where there is a need for a little custom function to modify strings or do simple math on a column. Today I am going to show how to create a User Defined Function (UDF) in Microsoft SQL.

Page 1 of 3

Powered by WordPress & Theme by Anders Norén