Skip to content

Commit 53247f0

Browse files
committed
Merge branch 'main' into feature/metadata-api
2 parents f59a42c + 531cad8 commit 53247f0

File tree

15 files changed

+370
-89
lines changed

15 files changed

+370
-89
lines changed

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
</a>
2424
</p>
2525

26+
## Wren AI @ Hacktoberfest 2024 - Oct 1 till Oct 31
27+
28+
[Hacktoberfest 2024](https://hacktoberfest.com/) is here, and we're inviting developers of all levels to join our open-source community. Together, we'll build Wren AI as a friendly community for all.
29+
30+
👉 Learn how to [Win Wren AI Exclusive Swag Pack & Holopin From Digital Ocean Rewards](https://getwren.ai/wren-ai-hacktoberfest-2024)!
31+
32+
[![image](https://github.com/user-attachments/assets/9048d701-a97b-4c6b-b3ed-fc636201f234)](https://getwren.ai/wren-ai-hacktoberfest-2024)
33+
34+
---
35+
2636
> Wren Engine is the semantic engine for LLMs, the backbone of the [Wren AI](https://github.com/Canner/WrenAI) project.
2737
2838
<img src="./misc/wren_engine_flow.png">
@@ -47,7 +57,7 @@ The Wren engine aims to be compatible with composable data systems. It follows t
4757
- [Benefits of Wren Engine with LLMs](https://docs.getwren.ai/engine/concept/benefits_llm)
4858

4959
## 🚧 Project Status
50-
Wren Engine is currently in the alpha version. The project team is actively working on progress and aiming to release new versions at least biweekly.
60+
Wren Engine is currently in the beta version. The project team is actively working on progress and aiming to release new versions at least biweekly.
5161

5262
## ⭐️ Community
5363

ibis-server/Dockerfile

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ FROM python:3.11-buster AS builder
33
# libpq-dev is required for psycopg2
44
RUN apt-get update && apt-get -y install libpq-dev
55

6-
# TODO: enable rust after fix the issue with the build
76
# Install rust
8-
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
9-
# ENV PATH="/root/.cargo/bin:$PATH"
7+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
8+
ENV PATH="/root/.cargo/bin:$PATH"
109

1110
# Install justfile
1211
RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/bin
@@ -25,15 +24,12 @@ ENV PYTHONUNBUFFERED=1 \
2524

2625
RUN pip install poetry==1.8.3
2726

28-
# TODO: enable rust after fix the issue with the build
29-
# COPY --from=wren-modeling-py . /wren-modeling-py
30-
# COPY --from=wren-modeling-rs . /wren-modeling-rs
27+
COPY --from=wren-modeling-py . /wren-modeling-py
28+
COPY --from=wren-modeling-rs . /wren-modeling-rs
3129

3230
WORKDIR /app
3331
COPY . .
34-
# TODO: enable rust after fix the issue with the build
35-
# RUN just install --without dev
36-
RUN poetry install --without dev
32+
RUN just install --without dev
3733

3834

3935
FROM python:3.11-slim-buster AS runtime

ibis-server/app/model/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class QueryClickHouseDTO(QueryDTO):
2121

2222

2323
class QueryMSSqlDTO(QueryDTO):
24-
connection_info: MSSqlConnectionInfo = connection_info_field
24+
connection_info: ConnectionUrl | MSSqlConnectionInfo = connection_info_field
2525

2626

2727
class QueryMySqlDTO(QueryDTO):

ibis-server/app/model/data_source.py

+6-27
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import base64
44
from enum import Enum, StrEnum, auto
55
from json import loads
6-
from urllib.parse import urlparse
76

87
import ibis
98
from google.oauth2 import service_account
@@ -13,7 +12,6 @@
1312
BigQueryConnectionInfo,
1413
ClickHouseConnectionInfo,
1514
ConnectionInfo,
16-
ConnectionUrl,
1715
MSSqlConnectionInfo,
1816
MySqlConnectionInfo,
1917
PostgresConnectionInfo,
@@ -66,6 +64,8 @@ def __init__(self, dto: QueryDTO):
6664

6765
def get_connection(self, info: ConnectionInfo) -> BaseBackend:
6866
try:
67+
if hasattr(info, "connection_url"):
68+
return ibis.connect(info.connection_url.get_secret_value())
6969
return getattr(self, f"get_{self.name}_connection")(info)
7070
except KeyError:
7171
raise NotImplementedError(f"Unsupported data source: {self}")
@@ -85,13 +85,7 @@ def get_bigquery_connection(info: BigQueryConnectionInfo) -> BaseBackend:
8585
)
8686

8787
@staticmethod
88-
def get_clickhouse_connection(
89-
info: ConnectionUrl | ClickHouseConnectionInfo,
90-
) -> BaseBackend:
91-
if hasattr(info, "connection_url"):
92-
url = info.connection_url.get_secret_value()
93-
# ibis miss port of connection url, so we need to pass it explicitly
94-
return ibis.connect(url, port=urlparse(url).port)
88+
def get_clickhouse_connection(info: ClickHouseConnectionInfo) -> BaseBackend:
9589
return ibis.clickhouse.connect(
9690
host=info.host.get_secret_value(),
9791
port=int(info.port.get_secret_value()),
@@ -102,7 +96,6 @@ def get_clickhouse_connection(
10296

10397
@staticmethod
10498
def get_mssql_connection(info: MSSqlConnectionInfo) -> BaseBackend:
105-
# mssql in ibis does not support connection url
10699
return ibis.mssql.connect(
107100
host=info.host.get_secret_value(),
108101
port=info.port.get_secret_value(),
@@ -113,13 +106,7 @@ def get_mssql_connection(info: MSSqlConnectionInfo) -> BaseBackend:
113106
)
114107

115108
@staticmethod
116-
def get_mysql_connection(
117-
info: ConnectionUrl | MySqlConnectionInfo,
118-
) -> BaseBackend:
119-
if hasattr(info, "connection_url"):
120-
url = info.connection_url.get_secret_value()
121-
# ibis miss port of connection url, so we need to pass it explicitly
122-
return ibis.connect(url, port=urlparse(url).port)
109+
def get_mysql_connection(info: MySqlConnectionInfo) -> BaseBackend:
123110
return ibis.mysql.connect(
124111
host=info.host.get_secret_value(),
125112
port=int(info.port.get_secret_value()),
@@ -129,11 +116,7 @@ def get_mysql_connection(
129116
)
130117

131118
@staticmethod
132-
def get_postgres_connection(
133-
info: ConnectionUrl | PostgresConnectionInfo,
134-
) -> BaseBackend:
135-
if hasattr(info, "connection_url"):
136-
return ibis.connect(info.connection_url.get_secret_value())
119+
def get_postgres_connection(info: PostgresConnectionInfo) -> BaseBackend:
137120
return ibis.postgres.connect(
138121
host=info.host.get_secret_value(),
139122
port=int(info.port.get_secret_value()),
@@ -153,11 +136,7 @@ def get_snowflake_connection(info: SnowflakeConnectionInfo) -> BaseBackend:
153136
)
154137

155138
@staticmethod
156-
def get_trino_connection(
157-
info: ConnectionUrl | TrinoConnectionInfo,
158-
) -> BaseBackend:
159-
if hasattr(info, "connection_url"):
160-
return ibis.connect(info.connection_url.get_secret_value())
139+
def get_trino_connection(info: TrinoConnectionInfo) -> BaseBackend:
161140
return ibis.trino.connect(
162141
host=info.host.get_secret_value(),
163142
port=int(info.port.get_secret_value()),

ibis-server/tests/routers/v2/connector/test_mssql.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ def test_query(mssql: SqlServerContainer):
145145
}
146146

147147

148-
@pytest.mark.skip(
149-
reason="ibis does not support mssql using connection url, wait fix PR in ibis repo"
150-
)
151148
def test_query_with_connection_url(mssql: SqlServerContainer):
152149
connection_url = _to_connection_url(mssql)
153150
response = client.post(
@@ -385,4 +382,4 @@ def _to_connection_info(mssql: SqlServerContainer):
385382

386383
def _to_connection_url(mssql: SqlServerContainer):
387384
info = _to_connection_info(mssql)
388-
return f"mssql://{info['user']}:{info['password']}@{info['host']}:{info['port']}/{info['database']}"
385+
return f"mssql://{info['user']}:{info['password']}@{info['host']}:{info['port']}/{info['database']}?driver=FreeTDS"

0 commit comments

Comments
 (0)