Skip to content

Commit

Permalink
docs(backend-info): prevent app from trying install duckdb extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jan 22, 2023
1 parent 2599c9b commit 3d94082
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions docs/backends/app/backend_info_app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import datetime
import tempfile
from pathlib import Path
from typing import List, Optional

import pandas as pd
import requests
import sqlglot
import streamlit as st

import ibis
from ibis import _
from ibis.backends import duckdb

ONE_HOUR_IN_SECONDS = datetime.timedelta(hours=1).total_seconds()

Expand All @@ -22,18 +23,22 @@

@st.experimental_memo(ttl=ONE_HOUR_IN_SECONDS)
def support_matrix_df():
backend: duckdb.Backend = ibis.connect('duckdb://')
support_matrix = (
backend.read_csv(
'https://ibis-project.org/docs/dev/backends/raw_support_matrix.csv'
)
.relabel({'FullOperation': 'full_operation'})
.mutate(
short_operation=_.full_operation.split(".")[4],
operation_category=_.full_operation.split(".")[3],
)
resp = requests.get(
"https://ibis-project.org/docs/dev/backends/raw_support_matrix.csv"
)
return support_matrix.execute()
resp.raise_for_status()

with tempfile.NamedTemporaryFile() as f:
f.write(resp.content)
return (
ibis.read_csv(f.name)
.relabel({'FullOperation': 'full_operation'})
.mutate(
short_operation=_.full_operation.split(".")[-1],
operation_category=_.full_operation.split(".")[-2],
)
.execute()
)


@st.experimental_memo(ttl=ONE_HOUR_IN_SECONDS)
Expand Down

0 comments on commit 3d94082

Please sign in to comment.