6th August 2020 - 7 PM CEST
Database Performance Tips with Django
In [8]: data = SiteStatsSchema().dump(stats) | |
In [9]: data | |
Out[9]: | |
{'meter_reading_count': 5, | |
'min_wh_generated': 1.0, | |
'last_reporting_time': '2020-07-31T15:08:45.109063', | |
'max_wh_generated': 22.0, | |
'max_capacity': 100.0} |
In [3]: import datetime | |
In [4]: now = datetime.datetime.now() | |
In [5]: stats = SiteStats(last_reporting_time=now, meter_reading_count=5, max_wh_generated=22, min_wh_generated=1, max_capacity=100) | |
In [6]: stats | |
Out[6]: SiteStats(last_reporting_time=datetime.datetime(2020, 7, 31, 15, 8, 45, 109063), meter_reading_count=5, max_wh_generated=22, min_wh_generated=1, max_capacity=100) |
@dataclass(frozen=True, eq=True) | |
class SiteStats: | |
"""Reporting stats for a site.""" | |
last_reporting_time: datetime.datetime | |
meter_reading_count: int | |
max_wh_generated: float | |
min_wh_generated: float | |
max_capacity: float |
from peewee import * | |
import datetime | |
db = SqliteDatabase('my_database.db') | |
class User(Model): | |
username = CharField(unique=True) |
I hereby claim:
To claim this, I am signing this object:
========================= | |
Join promotion in the ORM | |
========================= | |
[NOTE: We need better terms than promote and demote for changing the join | |
type. These terms are extremely easy to mix up. Maybe the ORM methods could | |
be to_inner_joins and to_louter_joins instead of promote_joins and demote_joins? | |
I tried to clean up the mis-usages of promotion/demotion but there could still | |
be some cases where these are mixed up] |
set smoothscroll | |
let blacklists = ["https://mail.google.com/*", "*://mail.google.com/*", "@https://mail.google.com/mail/*"] |
local network = hs.network.configuration.open() | |
local fastkitPath = '~/.rbenv/shims/fastkit' | |
local home = '/Users/andrew' | |
function fastkitCompleted(exitCode, stdOut, stdErr) | |
if exitCode ~= 0 then | |
hs.alert.show("Fastkit failed to reload") | |
log.d(stdOut) | |
end | |
end |
@-webkit-keyframes fadein { | |
from { | |
opacity: 0; | |
} | |
to { | |
opacity: 1; | |
} | |
} | |
#sVim-command { |