-
-
Notifications
You must be signed in to change notification settings - Fork 782
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google "How to X in SQLModel" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- I commit to help with one of those options 👆
Example Code
from typing import Optional
from sqlmodel import Field, Session, SQLModel, create_engine, select
class RealWordEN(SQLModel, table=True):
id: int = Field(primary_key=True)
string: str
type: Optional[str]
number: Optional[str]
tense: Optional[str]
__tablename__ = "real_words_EN"
engine = create_engine("mysql+mysql://root:root@localhost:8889/words", echo=True)
# engine = create_engine("mysql://root:root@localhost:8889/words", echo=True)
with Session(engine) as session:
statement = select(RealWordEN)
words = session.exec(statement)Description
I've been trying to interact with an existing MySQL DB.
When I try the run this code I get the following error message:
raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:mysql.mysql
I also tried with th DB URL format: engine = create_engine("mysql://root:root@localhost:8889/words", echo=True).
In that case, I get a different error message:
ModuleNotFoundError: No module named 'MySQLdb'
Is there some MySQL connection Python module that needs to be installed as well along sqlmodel?
I've been trying with installing pymysql, aiomysql, with similar errors.
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
3.9
Additional Context
No response
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested