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/dist/theme/statnett.css | 12 +++++++----- reveal.js/dist/theme/statnett.svg | 1 + reveal.js/sqlalchemy.html | 17 ++++++++++------- 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 reveal.js/dist/theme/statnett.svg (limited to 'reveal.js') diff --git a/reveal.js/dist/theme/statnett.css b/reveal.js/dist/theme/statnett.css index 5f5ab00..5c6d6af 100644 --- a/reveal.js/dist/theme/statnett.css +++ b/reveal.js/dist/theme/statnett.css @@ -40,11 +40,13 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba .reveal-viewport { background: #F0F1EB; + background-image: url("statnett.svg"); + background-repeat: no-repeat; background-color: #F0F1EB; } .reveal { font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif; - font-size: 22px; + font-size: 24px; font-weight: normal; color: #000; } @@ -117,8 +119,8 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba .reveal img, .reveal video, .reveal iframe { - max-width: 96%; - max-height: 96%; } + max-width: 95%; + max-height: 95%; } .reveal strong, .reveal b { @@ -179,10 +181,10 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba .reveal pre { display: block; position: relative; - width: 95%; + width: 90%; margin: 20px auto; text-align: left; - font-size: 0.60em; + font-size: 0.55em; font-family: monospace; line-height: 1.1em; word-wrap: break-word; } diff --git a/reveal.js/dist/theme/statnett.svg b/reveal.js/dist/theme/statnett.svg new file mode 100644 index 0000000..7f66194 --- /dev/null +++ b/reveal.js/dist/theme/statnett.svg @@ -0,0 +1 @@ + \ No newline at end of file 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 @@
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).
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)
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 });
+