Monday 28 April 2014

Beautiful South

http://proudsalopian.files.wordpress.com/2014/03/code_django.pngI have recently been looking into Django and Python as a new direction for my own programming. Whilst the default database migration is quite cool I think that for longer term projects with lots of iterative changes dbSync just does not cut it.

It didn’t take much digging to find mention of a project called South which is a more fully featured database migration tool for grown ups. Having had the migrations work without issue in DBSync I thought that once I had got South installed it would be a simple case of migrating and the job would be, as they say, ‘a good one’. Turns out that South is maybe a little less forgiving than I had thought….

I started off with some of my models defined…. Creating the actual upgrade scripts is as simple as issuing the following command:

$ python manage.py schemamigration MyApplication --initial
 
A cursory examination of my app and I now see a migrations folder, contained within is a 0001_initial.py file which contains the code required to upgrade my database. Great, without examining too closely I continued to apply the patches to the database

$ python manage.py migrate MyApplication
 
This too went of without issue and a cursory test of one of the models proved that my changes had indeed been applied:-

>>> from MyApplication.models import MetricIndex
 >>> MetricIndex.objects.all() []
 
Doesn’t look like much, but the empty block of course means that I have returned an empty array and NOT a big fat juicy error which is good! However my cursory examination of the upgrade script meant that I missed the detail…. I am using abstract inheritance for my tables because with many of the tables they have a lot of common fields. These fields are defined within an abstract model interface and then each table inherits from that. The upshot is I should have 1 database table created for each concrete class and no tables  created for the abstract classes. This was not what the scripts had generated within them. My model classes were defined thus:-

class ModelBase():
 Name =models.CharField(max_length=255)
 Order =models.IntegerField(default=-1)
 class meta:
 abstract =True
class MetricIndex(ModelBase):
 pass
 
Strange it should have worked… I should have had one MetricIndex table with two fields and no ModelBase table. The answer turned out to be frustratingly simple ( and remember, this worked correctly with dbSync). My abstract class was not defined correctly, ‘class meta’ should in fact have been ‘class Meta’. I applied the changes to the code as below

class ModelBase():
 Name =models.CharField(max_length=255)
 Order =models.IntegerField(default=-1)
 class Meta:
 abstract =True
class MetricIndex(ModelBase):
 pass
 
I then prepared the database script to migrate to the next iteration of the schema thus…

$ python manage.py schemamigration MyApplication --auto
 
And applied the schema changes as below

$ python manage.py migrate MyApplication
 
Voila…. I now had one properly formed MetricIndex table and no ModelBase table. Onward and upward and I urge you to use this great tool!

Written by Conrad Rowlands, Senior Systems Architect and Developer, DSCallards

Chaucer's Lost Works: A Graduate's Tale



In Ye Olde Times lived a young man looking to alter his world. He had overcome many challenges in life, most importantly the obstacle of higher education. 4 years had passed since he started that quest, yet in terms of tackling the present beast that lay before him, he needed to muster all his experience and know how in order to conquer this monster.  He needed to find a way to use his past experiences and encounters to tackle the challenge ahead. He began with a head-on approach. He utilized the main focus of his past 4 years, with the intent of using that to tackle and tame the beast that faced him.

After the cycle of many moons, the battle was against the young man. This approach was not suitable to at that time, to conquer the creature. The beast needed to be approached with a different method. The young man needed to rethink his strategy. 

He toiled for many days and many nights, attempting to conjure a solution. He looked to the town’s Master of Coin for a temporary method of funding his attempts. Everything had to come at a cost, until one day, he heard the ramblings of the village leper. “The path is never direct, the solution never easy. Look beyond your possible’s and you’ll find the answer, believe in me”. Insults hurled towards the leper, yet the message circled around the young mans head. Something was beginning to present itself. He toiled with the issue on the trudge back to his hut.  Scuffing the dirt beneath him, he tried to find an answer. He returned home and upon walking into his quarters, the results of his previous endeavours met his eye. A possible answer followed.

“Aha!!” he bellowed, much to the dismay of his fellow dwellers. “This diploma scroll holds the key. Not its content, but the entity of what it represents. If I can channel its meaning into the heart of the beast, then the creature can be overcome”. He knew of its potential, but to extract the truth and the weapon inside he needed the assistance of town haruspex.

He grabbed the scroll and rushed down the lane. He wanted to act fast. The soothsayer’s dwelling appeared, and he slammed the scroll on the pillar in front of the old man. “Ive got it” he cried with a hint of exhaustion and relief flowing through his voice. “But I need your assistance”. He looked at the frail Pareto who then accessed the town chronicles. He loomed over the book, arms spread wide and gazing to the heavens. His lips moved, yet sound was absent. Then suddenly, a purple light streamed from the tea-soaked pages. It was so striking, and gradually became dimmer and dimmer until all that remained was a large rope. He glared at the object and immediately realized its meaning. It represented all that had led upto to him obtaining the scroll. He sang praises of Pareto and rushed to tackle the beast head on.

There it stood, with wide jaws, shining razor-sharp claws and eyes as black as the night. Cries were heard when he charged towards the creature. The town was in awe. He seemed out of his depth, but when the beast charged in response, he shot into the air and landed on the creatures neck. He threw the rope around its throat to tame the creature. The battle insued for hours. He wasn’t sure what the outcome would be. Fear set in, but suddenly, the beast stumbled. He realized he was overcoming the power that faced him. And then finally, the beast dropped down and surrendered to the young man's talents.

It was done.

And where is this young man now?  He resides in the district of Callard, tackling the everyday issues he always had the ability to overcome. It took one moment of deep realization to unlock this adventurers potential.

The moral of this story: 

Whatever your University degree, and whatever your background, graduate employment is not to be feared. Yes, you may seek to use your degree, but sometimes the academic knowledge may not always correspond to commercial requirements and understanding. Graduate Schemes really unlock a graduates potential, not with the degree course itself, but with the experiences and life skills one accumulates throughout their higher education. 

I felt I had to approach an Archaeological career, but after experience in the sector, I didn’t want to lose my passion for it. I now use this passion as a hobby, and from a professional perspective, I now realize that a graduate scheme gives you great support, great training and in my case, an unbelievably trusting and amicable working environment. It is the best professional decision I have ever made, and am happy to be at DSCallards. 

Written by:  Tom Etheridge, Business Development Executive, DSCallards 


Tuesday 8 April 2014

My Guide to SAP Crystal Reports for Beginners


Mervin came to DSCallards with a problem, he found himself on a Monday morning trawling through hundreds of databases to write reports, although he did write the same report last week!! But because the data has changed he had to go back and do it all again, and again, and again (Groundhog Day!!).

So we came along and took away that pain for him with SAP Crystal Reports and instead of re-writing his reports each day and each week all he needed to do was create the reports once with the SAP Crystal Reports writer, then each time he ran that report it would update with the latest data. Simples! (We also helped Mervin with Crystal training) Now Mondays are fun, he can send the report via email in PDF format; he can print it or share the report with a flash file.

Due to the reports being so useful in the business the team was asking Mervin to create more and more reports every day or they needed updated versions of the reports already created so Mervin came to us to see if we could help again and we helped Mervin with a SAP Crystal Platform.

This opened the door for the business to securely open, view, interact with and share reports and dashboards over the Web. It enabled the business to intuitively explore and visualize data! Mervin could also setup security to control access to specific folders and reports. He could also specify the rights for users or groups, to schedule or export reports. 

Mervin could not believe how this revolutionized the whole reporting system. His team was able to pull their own reports at any time of the day and even change the built in parameters to tailor the reports for their department! Mervin even set up a burst if certain criteria wasn’t being met a report was sent out to highlight that in real time. 

The reports were now easy to read, with one true single form of data, Information came to life!!! 

The reports were now critical to the running of the business and as more and more colleagues wanted to analyze their own data Mervin was inundated for requests to write bespoke reports.  So he came to us and asked if there was anything that Crystal could do to help him with this and of course we came to the rescue and created a Universe.

We got to work on this right away; we created a virtual platform called a universe where you could ask the universe for a certain bit of information and the universe will talk to the databases and pull that information into a report that can be saved to the Crystal Platform. What was amazing is that this was so easy for everyone to do they didn’t need any technical background and they didn’t need to ask Mervin to do it for them.

Mervin was very happy, got a raise and lived happily ever after!

There are two types of businesses. The first have a BI system in place the other doesn’t. Who would your customers rather work with?

Written by Donna Hornickel, Sales Executive, DSCallards (and Mervin’s wife)

For more information, visit www.crystalreports.co.uk.