webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

postgresqlデータベースへのマネージド接続を提供する Quart 拡張機能「quart-db」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

postgresqlデータベースへのマネージド接続を提供する Quart 拡張機能「quart-db」のインストールについて解説しています。なお、「マネージド」とは「管理する」という意味。

「quart-db(https://github.com/pgjones/quart-db/)」は、Postgresqlデータベースへの接続を管理するQuart拡張モジュールです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■quart-dbをインストールする

quart-dbをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install quart-db

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。

py -3.8 -m pip install quart-db

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting quart-db

Downloading quart_db-0.3.0-py3-none-any.whl (8.5 kB)

Collecting buildpg>=0.4

Downloading buildpg-0.4-py3-none-any.whl (11 kB)

Collecting quart>=0.16.3

Downloading Quart-0.18.0-py3-none-any.whl (98 kB)

---------------------------------------- 98.6/98.6 kB 950.4 kB/s eta 0:00:00

Collecting asyncpg>=0.25.0

Downloading asyncpg-0.26.0-cp38-cp38-win_amd64.whl (531 kB)

---------------------------------------- 531.4/531.4 kB 1.7 MB/s eta 0:00:00

Collecting hypercorn>=0.11.2

Downloading Hypercorn-0.14.3-py3-none-any.whl (57 kB)

---------------------------------------- 57.9/57.9 kB 3.0 MB/s eta 0:00:00

Requirement already satisfied: itsdangerous in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (2.1.2)

Requirement already satisfied: jinja2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (3.1.2)

Requirement already satisfied: werkzeug>=2.2.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (2.2.2)

Requirement already satisfied: markupsafe in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (2.1.1)

Collecting blinker

Downloading blinker-1.5-py2.py3-none-any.whl (12 kB)

Requirement already satisfied: click in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (8.1.3)

Requirement already satisfied: importlib_metadata in c:\users\user_\appdata\roaming\python\python38\site-packages (from quart>=0.16.3->quart-db) (4.12.0)

Collecting aiofiles

Downloading aiofiles-22.1.0-py3-none-any.whl (14 kB)

Collecting h2>=3.1.0

Using cached h2-4.1.0-py3-none-any.whl (57 kB)

Requirement already satisfied: h11 in c:\users\user_\appdata\roaming\python\python38\site-packages (from hypercorn>=0.11.2->quart>=0.16.3->quart-db) (0.12.0)

Collecting wsproto>=0.14.0

Downloading wsproto-1.2.0-py3-none-any.whl (24 kB)

Collecting priority

Using cached priority-2.0.0-py3-none-any.whl (8.9 kB)

Collecting toml

Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)

Requirement already satisfied: colorama in c:\users\user_\appdata\roaming\python\python38\site-packages (from click->quart>=0.16.3->quart-db) (0.4.5)

Requirement already satisfied: zipp>=0.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from importlib_metadata->quart>=0.16.3->quart-db) (3.8.1)

Collecting hpack<5,>=4.0

Using cached hpack-4.0.0-py3-none-any.whl (32 kB)

Collecting hyperframe<7,>=6.0

Using cached hyperframe-6.0.1-py3-none-any.whl (12 kB)

Installing collected packages: wsproto, toml, priority, hyperframe, hpack, buildpg, blinker, asyncpg, aiofiles, h2, hypercorn, quart, quart-db

Successfully installed aiofiles-22.1.0 asyncpg-0.26.0 blinker-1.5 buildpg-0.4 h2-4.1.0 hpack-4.0.0 hypercorn-0.14.3 hyperframe-6.0.1 priority-2.0.0 quart-0.18.0 quart-db-0.3.0 toml-0.10.2 wsproto-1.2.0

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、quart-dbが正常にインストールされたことになります。

なお、今回はquart-dbのバージョン0.3.0をインストールしました。