gino icon indicating copy to clipboard operation
gino copied to clipboard

does it suport mysql?

Open wuyongwen opened this issue 7 years ago • 9 comments

  • GINO version: 0.8
  • Python version: 3.6
  • asyncpg version: 0.17.0
  • aiocontextvars version: 0.2.0

Description

does it suport mysql? i run the demo , it told me AttributeError: 'MySQLDialect_mysqldb' object has no attribute 'init_pool'

here is the code:

import asyncio
from gino import Gino

db = Gino()


async def main():
    # await db.set_bind('asyncpg://root:[email protected]:3306/api')
    await db.set_bind('mysql://root:[email protected]:3306/api')


asyncio.get_event_loop().run_until_complete(main())

wuyongwen avatar Nov 03 '18 20:11 wuyongwen

While it's definitely possible to support MySQL, we need serious work to achieve that. Sorry, but I can't see it happening soon. If anyone is interested in a PR, I'm very glad to review.

wwwjfy avatar Nov 04 '18 04:11 wwwjfy

You could use https://github.com/aio-libs/aiomysql to achieve this, just like you lads are currently using asyncpg for postgres.

alextwothousand avatar Apr 05 '19 15:04 alextwothousand

@infin1tyy Yes! Thanks for the clue. I believe Paul from Gitter was trying to add SQLite support too. These new dialects should be expected in GINO 1.1 or later.

fantix avatar Apr 05 '19 16:04 fantix

@infin1tyy Yes! Thanks for the clue. I believe Paul from Gitter was trying to add SQLite support too. These new dialects should be expected in GINO 1.1 or later.

My pleasure 😂 I'll be patiently waiting for v1.1 then :) https://github.com/jreese/aiosqlite for SQLite.

alextwothousand avatar Apr 05 '19 20:04 alextwothousand

Is there any update plan for mysql support?

zhujinhe avatar Mar 19 '20 10:03 zhujinhe

@zhujinhe sorry, no we didn't have any contribution to support MySQL by far. PRs are more than welcome!

fantix avatar Mar 28 '20 20:03 fantix

Update: I gave a try lately, and it turned out to be not difficult. But it does take more time to make the code compatible with both databases, especially tests. Likely I'll have a draft PR soon.

wwwjfy avatar Apr 29 '20 16:04 wwwjfy

I'm working on GINO 2 for SQLAlchemy 1.4 / 2.0 here: https://github.com/python-gino/gino/commits/v2.0.x. This is, for now, a rewrite from scratch, but it will merge code from GINO 1.x once the foundation is ready.

Now the code has both PostgreSQL/asyncpg and MySQL/aiomysql support. It might be helpful for the MySQL support in GINO 1.1 here.

fantix avatar May 17 '20 18:05 fantix

Sorry for being dormant. have been distracted by others lately. I have my branch to get basic works, but there are more nuances than I expected to fix. I'm doing it by "adding" features via fixing tests.

I'll say it's around 60~70% on the way. If anyone has time, can also help to submit PR there or branch from it.

wwwjfy avatar May 17 '20 18:05 wwwjfy