Package: aiosql-mysql
aiosql-mysqlTable of ContentsAbout The ProjectGetting StartedUsageContributingLicenseContactThanksAbout The Projectaiosql-mysql is a database adaptor intended to allow the use ofasyncmywithaiosql.Warning:This project is in early developement. The PyMySQL adaptor works but is not fully tested. AsyncMy is not implimented and working at this time, please check back later.Getting StartedFor information about cloning and dev setup see:ContributingUsageThis is example is adapted from aiosql's readme.users.sql-- name: get-user-by-username^SELECT*FROMusersWHEREusername=:username;-- name: create_users#CREATETABLEusers(useridINTNOTNULLAUTO_INCREMENTPRIMARYKEY,usernameVARCHAR(100),firstnameVARCHAR(100),lastnameVARCHAR(100));-- name: insert_bob!INSERTINTOusers(username,firstname,lastname)VALUES('bob','bob','smith');Blocking executionIndexing a document adds it to or updates it in the search store.importaiosqlimportpymysqlfromaiosql_mysqlimportPyMySQLAdaptorconn=pymysql.connect(host="127.0.0.1",port=3306,user="root",password="password",database="ExampleDb",cursorclass=pymysql.cursors.DictCursor,)queries=aiosql.from_path("./users.sql",PyMySQLAdaptor)queries.create_users(conn)queries.insert_bob(conn)result=queries.get_user_by_username(conn,username="bob")print(result)# {'userid': 1, 'username': 'bob', 'firstname': 'bob', 'lastname': 'smith'}For a more detailed and complete version of the above example seepymysql_example.py&users.sqlAsync executionimportaiosqlimportasyncmyfromaiosql_mysqlimportAsyncMySQLAdapterqueries=aiosql.from_path("./users.sql",AsyncMySQLAdapter)asyncdefmain():conn=awaitasyncmy.connect(host="127.0.0.1",port=3306,user="root",password="password",database="ExampleDb",)awaitqueries.create_users(conn)awaitqueries.insert_user(conn,user_name='sbob',first_name='Bob',last_name='Smith')result=awaitqueries.get_user_by_username(conn,username="sbob")print(result)if__name__=="__main__":importasyncioasyncio.run(main())# {'userid': 1, 'username': 'sbob', 'firstname': 'Bob', 'lastname': 'Smith'}For a more detailed and complete version of the above example seeasyncmy_example.py&users.sqlContributingSee theopen issuesfor a list of proposed features (and known issues).Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)execute: py.test --cov-report xml:cov.xml --covCommit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestCloning / Development setupClone the repo and installgitclonehttps://github.com/kajuberdut/aiosql-mysql.gitcdaiosql-mysql
pipenvinstall--devRun testspipenvshell
wardFor more about pipenv see:Pipenv GithubLicenseDistributed under the MIT. SeeLICENSEfor more information.ContactPatrick Shechet -patrick.shechet@gmail.comProject Link:https://github.com/kajuberdut/aiosql-mysqlThanksThis library would be pointless without:Will Vaughn, creator of aiosqlThe other contributors to aiosqlThe PyMySql TeamLong2Ice, creator of asyncmyThe aiomysql team who's work makes asyncmy possibleMany Many others in the Python and Open Source communities