Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ray Cote Newsgroups: comp.lang.python Subject: Looking for examples of using aiopg with aiohttp and non-async startup. Date: Thu, 25 Feb 2016 17:23:50 -0500 Lines: 29 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de OpEZY+EdAmZwChSzRIvxUAQzI71fM+eb9qKEozpM5S5g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'handler': 0.04; 'subject:using': 0.09; 'way:': 0.09; '\xe2\x80\x94': 0.09; 'async': 0.16; 'doesn\xe2\x80\x99t': 0.16; 'handler)': 0.16; 'hello:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:non': 0.16; 'app': 0.16; 'seems': 0.23; 'interfaces': 0.23; 'example': 0.26; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; 'correct': 0.28; 'starts': 0.29; 'connection': 0.30; 'raymond': 0.30; 'received:google.com': 0.35; 'integrate': 0.35; 'but': 0.36; 'project': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'received:209.85.213': 0.37; 'received:209': 0.38; 'skype:': 0.38; 'someone': 0.38; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'provide': 0.61; 'email:': 0.62; 'skip:w 40': 0.66; '8bit%:46': 0.76; 'await': 0.76; 'application?': 0.84; 'we\xe2\x80\x99re': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appropriatesolutions.com; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=TsIdAx5Jwyl+6b+TgLFTaz0xO45H5l8Get5VK0ang74=; b=d+/it9bVW2ClULO8qcn7YPtABtvgtB/qO1d9lbWQHrhzX8M8Wd0FkHiSIpLKOzk5pM hzJyxegA5c22SRGLsBsPCLtFwbsplUKDrDyWJ3A2eNBGKuxAmDC6PJdtHsuNC9F3YvFS k+coRtT0u7rISPSZHPRnKPC4mSMYZv41B++gc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=TsIdAx5Jwyl+6b+TgLFTaz0xO45H5l8Get5VK0ang74=; b=AWngUMBW96dL4PL6LphlnkKiQsoStskBUciCCQ7wtZhDWsJ9fyx1pXf+9MPfPFM91G u0Ovull41bXXPZSYaP07fUVqtVQfrbtjm7EUxL2MTVKLZENykuJt1V21bgD3JBN3woz3 izL9Ch21olIlig1EodJxp5AhDQiWqYTDv05UeHbLghKScMaIWUh8H4iCyHNMezjgnx6Y ERDfN9C3BNCKBMPMs+czV+E1E2m7SBYJoHJcJurNUexsyw3i1mm1pFMHlEXNRW9MSIgy hMC7nJgs6kq/HC5zCHYY1r+E6YY+t8ZOqN+1P1tckKcv5HLrzyEviQlZiGZTQpcML/l4 gFlg== X-Gm-Message-State: AG10YORZZyz739QShQYebrRt/SZUWP4nL3kfSXdNYTSUR6pi1ZVB0JAsbtCjEIf81weJoaq69nUI7Xs2vhzW9w== X-Received: by 10.31.6.143 with SMTP id 137mr39223213vkg.133.1456439059364; Thu, 25 Feb 2016 14:24:19 -0800 (PST) X-Content-Filtered-By: Mailman/MimeDel 2.1.21rc2 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103521 Hello: I have an aiohttp project that starts in the usual way: app =3D web.Application() app.router.add_route(=E2=80=98POST=E2=80=9D, =E2=80=98/=E2=80=98, handler) web.run_app(app) My question is, how do I work with an aiopg.pool with aiohttp? There only seems to be async interfaces into aiopg =E2=80=94 but I don=E2= =80=99t want to create the pool in my handler since that requires a connection on each transaction. I found one example that was app[=E2=80=9Cdb=E2=80=9D] =3D await aiopg.create_pool(dsn) but that doesn=E2=80=99t seen correct since we=E2=80=99re not yet in a loop= . Can someone please provide an example showing the proper way to integrate aiopg pool into an aiohttp web application? Regards =E2=80=94Ray --=20 Raymond Cote, President voice: +1.603.924.6079 email: rgacote@AppropriateSolutions.com skype: ray.cote