You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/20 17:17:06 UTC

[GitHub] [skywalking-python] tom-pytel opened a new pull request #168: filled out rest of psycopg 3 plugin

tom-pytel opened a new pull request #168:
URL: https://github.com/apache/skywalking-python/pull/168


   A copy of psycopg2 to psycopg 3 was not enough since some interface stuff changed, this PR adds those changes:
   * Removed Cursor.callproc()
   * Added Cursor.stream()
   * Hook Connection.connect()
   * Instrumented AsyncConnection and AsyncCursor (which is the main point of psycopg 3 I think :)
   * Still needs a test, will add simple script to convert to test if anyone is up for it, @Superskyyy ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-python] kezhenxu94 merged pull request #168: filled out rest of psycopg 3 plugin

Posted by GitBox <gi...@apache.org>.
kezhenxu94 merged pull request #168:
URL: https://github.com/apache/skywalking-python/pull/168


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-python] tom-pytel commented on pull request #168: filled out rest of psycopg 3 plugin

Posted by GitBox <gi...@apache.org>.
tom-pytel commented on pull request #168:
URL: https://github.com/apache/skywalking-python/pull/168#issuecomment-948452500


   BTW, @kezhenxu94, this is good for merge, just missing the the test which @Superskyyy gave thumbs up so will probably add along with celery test in a different PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-python] tom-pytel commented on pull request #168: filled out rest of psycopg 3 plugin

Posted by GitBox <gi...@apache.org>.
tom-pytel commented on pull request #168:
URL: https://github.com/apache/skywalking-python/pull/168#issuecomment-947871440


   Simple test script:
   ```py
   #!/usr/bin/env python
   
   from skywalking import agent
   agent.start()
   
   import asyncio
   import psycopg
   
   # with psycopg.connect('postgresql://root:root@localhost:15432/admin') as conn:
   with psycopg.Connection.connect('postgresql://root:root@localhost:5432/admin') as conn:
       with conn.cursor() as cur:
           sql = "select * from user where user = %s"
   
           cur.execute(sql, ("root",))
           print(cur.fetchall())
   
           cur.executemany(sql, (("root",), ("root",)))
           print(cur.fetchall())
   
           for res in cur.stream(sql, ("root",)):
               print(res)
   
   async def main():
       async with await psycopg.AsyncConnection.connect('postgresql://root:root@localhost:5432/admin') as aconn:
           async with aconn.cursor() as acur:
               sql = "select * from user where user = %s"
   
               await acur.execute(sql, ("root",))
               print(await acur.fetchall())
   
               await acur.executemany(sql, (("root",), ("root",)))
               print(await acur.fetchall())
   
               async for res in acur.stream(sql, ("root",)):
                   print(res)
   
   asyncio.run(main())
   
   from time import sleep; sleep(1)  # BUG? Agent is supposed to flush pending segments on exit so this should not be needed, but it is.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org