A union of curiosity and data science

Knowledgebase and brain dump of a database engineer


Setting Up Eclipse for Python Development

Install Java: https://java.com/en/download/

Install Eclipse (Neon is the latest as of this post):  https://eclipse.org/downloads/

Install Python: https://www.python.org/downloads/

 

Startup Eclipse:
Accept the default workspace or create your own.
Get PyDev : Go to Help > Install New Software...

Click "Add...", enter "PyDev" for name
Enter the following location: http://pydev.org/updates.
Click Ok.

Check PyDev

Accept Agreement

Accept Certificate

Restart Eclipse

Setup the interpreter: go to eclipse preferences. 

 

Once in preferences: Open PyDev > Interpreters > Python Interpreters

 Select "New" > Enter a name (The name of your current python version). 
Add the path to the python executable. 

Select All Libs > click OK

Now that we have our interpreter setup, let's test all of this stuff. 

create a new project: File > New > PyDev Project

HelloWorld. Set the Grammar and the Interpreter > click finish.

Right click your project folder click New > File.

Filename: HelloWorld.py

You can set your default eclipse preferences when prompted. I uncheck everything. 

Add the following to your hello world file. 

#!/usr/bin/python3
print("Hello, World!")

 

 

Run the code:

Result: 

SQL Server 2012 CLR Function - Google Web Services : Address Distance Matrix API

Google Documentation:  https://developers.google.com/maps/documentation/distance-matrix/

 

I created a CLR function that goes out to the google api and pulls in distances between two addresses. 

Doing this through the CLR was not the most ideal scenario but it worked for this project. I probably wouldn't have an API call in the middle of my set based operations but this function will be used infrequently and the results of distances between common points will be stored in a look up table. This exercise will not include that look up table. We will just go through the steps to get and API key for the Google Address API and Create the CLR Function. 

Result: 

 

Step 1. Get a google api address key. 

https://developers.google.com/maps/documentation/javascript/get-api-key

Sign in with your google account. 

Agree to the terms if you want to use someone else's hard work.