Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
x-airflow-common: &airflow-common
build:
context: ./airflow
image: sagerx_airflow:v0.0.7 # versioning allows a rebuild of docker image where necessary
image: sagerx_airflow:v0.0.2718 # versioning allows a rebuild of docker image where necessary
networks:
- airflow-dbt-network
env_file:
Expand Down Expand Up @@ -50,6 +50,21 @@ services:
context: .
shm_size: "4gb"

marimo:
build:
context: ./marimo
image: sagerx_marimo:v0.0.1
networks:
- airflow-dbt-network
container_name: marimo
ports:
- "2718:2718"
volumes:
- ./notebooks:/notebooks
working_dir: /notebooks
environment:
- DATABASE_URL=postgresql://sagerx:sagerx@postgres:5432/sagerx

pgadmin:
image: dpage/pgadmin4:9.9
networks:
Expand Down
19 changes: 19 additions & 0 deletions marimo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.11-slim

# Install marimo and database dependencies
RUN pip install --no-cache-dir \
marimo \
psycopg2-binary \
sqlalchemy \
pandas \
numpy

# Create marimo config directory
RUN mkdir -p /root/.marimo

# Copy the marimo configuration
COPY marimo.toml /root/.config/marimo/marimo.toml

WORKDIR /notebooks

CMD ["marimo", "edit", "--host", "0.0.0.0", "--port", "2718", "--no-token"]
15 changes: 15 additions & 0 deletions marimo/marimo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[display]
theme = "dark"

[datasources]
auto_discover_schemas = true
auto_discover_tables = true
auto_discover_columns = true

[datasources.sources.postgres]
dialect = "postgresql"
host = "postgres"
port = 5432
database = "sagerx"
username = "sagerx"
password = "sagerx"
39 changes: 39 additions & 0 deletions notebooks/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import marimo

__generated_with = "0.17.7"
app = marimo.App(width="medium")


@app.cell
def _():
import os
import sqlalchemy

DATABASE_URL = os.environ.get("DATABASE_URL")
sagerx = sqlalchemy.create_engine(DATABASE_URL)
return (sagerx,)


@app.cell
def _():
import marimo as mo
return (mo,)


@app.cell
def _(mo, sagerx):
_df = mo.sql(
f"""
select
*
from sagerx_dev.stg_fda_ndc__ndcs
limit 100

""",
engine=sagerx
)
return


if __name__ == "__main__":
app.run()