Skip to content

Commit

Permalink
odbc
Browse files Browse the repository at this point in the history
  • Loading branch information
briggsb9 committed Sep 10, 2024
1 parent 8af55a2 commit 523f46e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions scripts/prepdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,33 @@ done <<EOF
$(azd env get-values)
EOF

echo 'Installing ODBC driver'
if ! [[ "18.04 20.04 22.04 23.04 24.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi

# Add the signature to trust the Microsoft repo
# For Ubuntu versions < 24.04
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
# For Ubuntu versions >= 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

Expand Down

0 comments on commit 523f46e

Please sign in to comment.