Skip to content

Commit a5fdeb5

Browse files
feat(materialize): add Materialize engine spec
1 parent 5a30c85 commit a5fdeb5

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
2+
from superset.db_engine_specs.postgres import PostgresEngineSpec
3+
4+
class MaterializeEngineSpec(PostgresEngineSpec):
5+
engine = "materialize"
6+
engine_name = "Materialize"
7+
8+
default_driver = "psycopg2"
9+
10+
# TODO: Fix the URI after making the dialect, also for connection_string
11+
sqlalchemy_uri_placeholder = (
12+
"materialize+psycopg2://username:password@host:port/database"
13+
)
14+
15+
metadata = {
16+
# Required fields
17+
"description": "A brief description of the database.",
18+
"categories": [
19+
DatabaseCategory.CLOUD_AWS,
20+
DatabaseCategory.TRADITIONAL_RDBMS,
21+
DatabaseCategory.OPEN_SOURCE,
22+
],
23+
# TODO: Add package name for SQLAlchemy dialect after making it
24+
"pypi_packages": ["psycopg2", "sqlalchemy-materialize"],
25+
"connection_string":
26+
"materialize+psycopg2://{username}:{password}@{host}:{port}/{database}",
27+
28+
# Recommended fields
29+
"logo": "materialize.svg", # TODO: Logo file in docs/static/img/databases/
30+
"homepage_url": "https://materialize.com/",
31+
"default_port": 6875,
32+
}
33+
34+
35+
# NOTES:
36+
# - Time grains inherited from Postgres work. Tested in Materialize Console.
37+
# - TODO: Test in SQLLab once pg_catalog.pg_opclass thingy is fixed
38+
# I think I fixed pg_opclass in the dialect, but there's more to fix
39+
# e.g. afaik, foreign key is not supported in Materialize.
40+
# and theres like get_foreign_key() function or similar in the dialect.

0 commit comments

Comments
 (0)