Archive | October, 2009

Reloading Modules in a Python Interpreter

3. October 2009


If you have edited an external module (or .py file), you can reload the module from within the python interpreter by using the following command: reload(myModule) This assumes that you have imported the module at some point within your interpreter session. When Is This Useful It’s helpful if you are debugging code in a IDE […]

Continue reading...

Creating Temporary Tables in SQL Server

2. October 2009

Comments Off on Creating Temporary Tables in SQL Server

Here are three methods of creating and working with temporary tables in Microsoft SQL Server: Method 1: Select Into This is a quick and dirty method to create a temporary table. Compared to the other methods, you do not have to define the column names. Just add the ‘into #temptablename’ at the end of the […]

Continue reading...

Getting Distinct Rows Using Django Database Layer

1. October 2009


To get the equivalent of the SQL select distinct statement in Django, you can use a combination of the values() and distinct() method of the QuerySet api. For example, you have a musicians table and you want to get list of instruments that they play (with no duplicates): Musicians.objects.values('instrument').distinct() The values(‘instrument’) method will generate a […]

Continue reading...