
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
aiosql-mysql is a database adaptor intended to allow the use of asyncmy with aiosql.
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.
For information about cloning and dev setup see: Contributing
This is example is adapted from aiosql's readme.
users.sql
-- name: get-user-by-username^
SELECT *
FROM users
WHERE username = :username;
-- name: create_users#
CREATE TABLE users ( userid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100),
firstname VARCHAR(100),
lastname VARCHAR(100)
);
-- name: insert_bob!
INSERT INTO users (username, firstname, lastname)
VALUES ('bob', 'bob', 'smith');
Indexing a document adds it to or updates it in the search store.
import aiosql
import pymysql
from aiosql_mysql import PyMySQLAdaptor
conn = 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 see pymysql_example.py & users.sql
import aiosql
import asyncmy
from aiosql_mysql import AsyncMySQLAdapter
queries = aiosql.from_path("./users.sql", AsyncMySQLAdapter)
async def main():
conn = await asyncmy.connect(
host="127.0.0.1",
port=3306,
user="root",
password="password",
database="ExampleDb",
)
await queries.create_users(conn)
await queries.insert_user(conn,user_name='sbob', first_name='Bob', last_name='Smith')
result = await queries.get_user_by_username(conn, username="sbob")
print(result)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
# {'userid': 1, 'username': 'sbob', 'firstname': 'Bob', 'lastname': 'Smith'}
For a more detailed and complete version of the above example see asyncmy_example.py & users.sql
See the open issues for 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 are greatly appreciated.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)git clone https://github.com/kajuberdut/aiosql-mysql.git
cd aiosql-mysql
pipenv install --dev
pipenv shell
ward
For more about pipenv see: Pipenv Github
Distributed under the MIT. See LICENSE
for more information.
Patrick Shechet - patrick.shechet@gmail.com
Project Link: https://github.com/kajuberdut/aiosql-mysql
This library would be pointless without:
FAQs
A MySQL driver adaptor for aiosql
We found that aiosql-mysql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.