From 523f46e57ce0d15b72e5880f673127e9b9ee3bcc Mon Sep 17 00:00:00 2001 From: briggsb9 Date: Tue, 10 Sep 2024 16:03:39 +0100 Subject: [PATCH] odbc --- .devcontainer/devcontainer.json | 2 +- scripts/prepdata.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d24bb2c..aee6497 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ "forwardPorts": [ // Forward ports if needed for local development ], - "postCreateCommand": "chmod +x ./scripts/prepdata.sh && sudo apt-get update && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 && sudo apt-get install -y unixodbc-dev", + "postCreateCommand": "chmod +x ./scripts/prepdata.sh", "remoteUser": "vscode", "hostRequirements": { "memory": "8gb" diff --git a/scripts/prepdata.sh b/scripts/prepdata.sh index 8b0862e..5eafa40 100644 --- a/scripts/prepdata.sh +++ b/scripts/prepdata.sh @@ -11,6 +11,33 @@ done <= 24.04 +curl https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg + +# Add repo to apt sources +curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list + +# Install the driver +sudo apt-get update +sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 +# optional: for bcp and sqlcmd +sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18 +echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc +source ~/.bashrc +# optional: for unixODBC development headers +sudo apt-get install -y unixodbc-dev + + echo 'Creating python virtual environment "scripts/scripts_env"' python3 -m venv scripts/scripts_env