From 85c1bd41d6b3b985bb6794ebe066128c51e7c8fd Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 16 Mar 2021 11:03:38 +0100 Subject: Improve reveal.js/sqlalchemy.html and start working on the Statnett theme --- reveal.js/sqlalchemy.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'reveal.js/sqlalchemy.html') diff --git a/reveal.js/sqlalchemy.html b/reveal.js/sqlalchemy.html index 578fc13..6acd9b7 100755 --- a/reveal.js/sqlalchemy.html +++ b/reveal.js/sqlalchemy.html @@ -48,7 +48,7 @@

What is SQLAlchemy?


SQLAlchemy is a Python library created by Mike Bayer to provide a high-level Pythonic interface to RDBMS such as PostgreSQL, SQLite, MySQL, Oracle, DB2.

-

SQLAlchemy includes RDBMS-independent SQL expression language and an object-relational mapper (ORM).

+

SQLAlchemy includes RDBMS-independent SQL expression language and an object-relational mapper (ORM).

@@ -59,7 +59,7 @@
  • portability - the programming interface is independent of the type of RDBMS and connector used

  • security - no more SQL injections

  • abstraction - no need to bother with complex JOINs

  • -
  • object-orientation - you work with objects and NOT tables and rows

  • +
  • object-orientation - you work with objects instead of tables and rows

  • performance - exploits the likehood of reusing a particular query

  • flexibility - you can override almost anything

  • 0.0125 karma points for each MB transferred (2021)

  • @@ -72,9 +72,9 @@
    @@ -86,6 +86,7 @@ import sqlalchemy sqlalchemy.__version__ + # Out: '1.3.23' from sqlalchemy import create_engine @@ -95,7 +96,6 @@ # and driver the name of a DBAPI, such as psycopg2, pyodbc, cx_oracle # The echo flag is a shortcut to setting up SQLAlchemy logging, # which is accomplished via Python’s standard logging module. - # With it enabled, we’ll see all the generated SQL produced. # engine = create_engine("sqlite:///library.db", echo=True) engine = create_engine("sqlite:///:memory:", echo=True) @@ -296,7 +296,8 @@ session.query(Book).join(Author).filter(Author.name == "Richard Dawkins").all() session.query(Book).\ from_statement("SELECT b.* FROM books b, authors a WHERE b.author_id = a.author_id AND a.name=:name").\ - params(name="Richard Dawkins").all() + params(name="Richard Dawkins").all() + session.query(Book).filter(Book.author == author_1).all() @@ -336,6 +337,7 @@ # Out: [<__main__.Book at 0x7f132bdf0130>] # WHERE (abs(books.book_id) > ?) IS 1 ... in the case of func.abs + # with Pandas df = pd.read_sql_table("my_table", con=session.get_bind()) # or con=engine df = pd.read_sql_query(query.statement, engine) @@ -370,7 +372,8 @@ // Learn about plugins: https://revealjs.netlify.app/plugins/ plugins: [ RevealZoom, RevealNotes, RevealSearch, RevealMarkdown, RevealHighlight ] }); - + Reveal.configure({ pdfSeparateFragments: false }); + -- cgit v1.3