diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-28 16:41:01 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-28 16:41:09 +0100 |
| commit | 9535cab8d794a01134b8dccfbf54ebf3eac65037 (patch) | |
| tree | da0dbc31f1db1a8ed8670ddf29353e891c8c86e3 /database.py | |
| parent | 769fd6527b0a36cd59537953d34721d28fd62042 (diff) | |
| download | apigrabber-9535cab8d794a01134b8dccfbf54ebf3eac65037.tar.gz apigrabber-9535cab8d794a01134b8dccfbf54ebf3eac65037.zip | |
api: get new matches more reliably, remove now unused `db.meta`
Diffstat (limited to 'database.py')
| -rw-r--r-- | database.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/database.py b/database.py index a54f7b5..daab3a3 100644 --- a/database.py +++ b/database.py @@ -75,34 +75,6 @@ class Database(object): tasks.append(task) await asyncio.gather(*tasks) - async def meta(self, key, value=None): - """Sets or gets data into a dictionary-like database object. - - :param key: ID of the value. - :type key: str - :param value: (optional) Value to set. - :type value: object - :return: If `value` is None, the value the database entry. - :rtype: object - """ - async with self._pool.acquire() as conn: - async with conn.transaction(): - await conn.execute("CREATE TABLE IF NOT EXISTS meta " + - "(key TEXT PRIMARY KEY, value jsonb)") - if value is not None: - value = json.dumps(value) - await conn.execute("INSERT INTO meta(key, value) " + - "VALUES ($1, $2) " + - "ON CONFLICT (key) DO " + - "UPDATE SET value=$2", - key, value) - else: - result = await conn.fetch("SELECT value FROM meta " + - "WHERE key='" + key + "'") - if len(result) == 0: - raise KeyError - return json.loads(result[0]["value"]) - async def execute(self, query, args): """Runs an SQL statement. |
