I wrote a minimal database dialect for SQLAlchemy that doesn't really belong in the core. How do I make it work as its own Python package?
The dialect is the system SQLAlchemy uses to communicate with various types of DBAPI implementations and databases. The sections that follow contain reference documentation and notes specific to the usage of each backend, as well as notes for the various DBAPIs.
A database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML.
SQLAlchemy indicates the source of an Engine as a URI combined with optional keyword arguments to specify options for the Engine. The form of the URI is: dialect+driver://username:password@host:port/database. Many of the parts in the string are optional.
As of SQLAlchemy 0.8, you can register the dialects in-process without needing to have a separate install.
from sqlalchemy.dialects import registry
registry.register("mysql.foodialect", "myapp.dialect", "MyMySQLDialect")
The above will respond to create_engine("mysql+foodialect://")
and load the MyMySQLDialect
class from the myapp.dialect
module.
See: https://docs.sqlalchemy.org/en/latest/core/connections.html#registering-new-dialects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With