Python Scaffolding SQL tables

Scaffolding support in a framework is a rapid means of implementing crud, i.e. a means of maintaining the database on which we will base our application

Crud is an acronym for Create, read, update and delete, operations that may need to be applied to rows in a table.

Scrudsie could be an acronym adding sorting, selecting, importing and exporting.

If we map out a database for an application, or we are looking to access data that already exists, and have come across dozens or hundreds of table formats, scaffolding is a means of coding crud functions for a table, or even for all tables, in just a few lines of code.

Scaffolding should occur within an Auth framework, especially a utility crud function where any table could have records added, deleted or modified.

Additionally, scaffolding could use a template that defines the entire DOM or identified DIV elements within a DOM (DOM definition wikipedia w3c)

DOM, in this context, stands for Document Object Model, and refers to all the html from the initial doctype definition tag through the final ending tag. Simply “view source” and the chaos of header, body, javascript, meta, link, css, divs, tables, lists and such things is very well known and defined

Python Crud with MySQL

Let’s do the same thing with MySql

pip install MySQL-python
import MySQLdb

class mydbconn():
    def __init__(self):
        self.con = MySQLdb.connect('x', 'x', 'x', 'x')

    def get_columns(self,table):
        cuc = self.con.cursor()
        cursData = cuc.execute("SHOW columns FROM " + table)
        HEADERS = cuc.fetchall()
        keyName = HEADERS[0][0]
        keyLen = self.lenFunction(HEADERS[0][1])
        return keyName, keyLen, HEADERS

    def lenFunction(self,varCharString):
        x = varCharString.find("(")
        varCharString = varCharString[x+1:]
        x = varCharString.find(")")
        varCharString = varCharString[:x]
        return int(varCharString)

if __name__=="__main__":
    con = mydbconn()
    keyName, keyLen, h = con.get_columns("customer")
    for i in h:
        print i

On the fifth line of the program, use your MySql credentials. Sometimes the first parameter is localhost, the second x is the username for the database, the password is third and the name of the database is fourth.

You also have to change the parameter in line 2 of the __main__ section to the name of the table you are using. This routine also has been used with databases that had a key other than named id for the first field, and it was important to have the name of the key and its length to proceed with scaffolding

In the Sqlite3 sqlalchemy example, we got a list of field names. In this example, we get a tuple of tuples. At this point, tuples might be a preferred format, they are immutable and hashable, and a utility crud function would not need to add and remove things from the tuple. However, in a more sophisticated scaffolding environment, you would add things like a field for password verification or especially remove things, like the ability to change certain fields.

Zoho Invoice

Billing and Accounts Receivable, Cloud Invoice

For a small business, we a have just looked at Zoho Invoice. Zoho Invoice is a cloud based accounting system much like QuickBooks OnLine for small business invoicing. We are really impressed with the user interface. The initial sign up phase for a thirty day trial required e-mail verification, so it actually was several days ago that we first considered doing a review for Zoho accounting. But this morning, after digging through my e-mail for the verification links, we completed the process and began to evaluate the invoicing process for a simple time billing scenario such as a consultant would use.

First, we looked for a way to create an invoice. Zoho could not have made the link to begin creating an invoice any easier to pick out of the computer screen. This is a sharp contrast to QuickBooks which, even with it’s navigation screen, leaves us sometimes staring at all the things we can do and wondering where we went to do invoices.

Next, we know that there is really no such thing as an invoicing system without a customer file. And we had no customers entered into the system. Zoho could not have made this step easier. Just below the customer drop down box is a link to create a new customer. And upon adding a new customer, also a little easier than QB, was an option to save the customer and continue entering the invoice we had started.

Very smooth and intuitive, within three minutes, we had created an invoice for a customer, This left me wondering how I could e-mail and print the invoice. With a little glancing around, on the right side of the screen are options to email and print the invoice. Viola!

Having consulted for dozens of companies for 25 years, I wish I had this resource years ago. We will have more information on Zoho invoicing and accounts receivable coming up.

Linux CRM

CRM, or Customer Relationship Management is a class of collaborative applications for enterprises that keep track of prospects, leads, customers, customer complaints, orders and shipments.

CRM, or Customer Relationship Management is a class of collaborative applications for enterprises that keep track of prospects, leads, customers, customer complaints, orders and shipments. Companies wishing to better serve customers in support situations as well as equip their sales force with tools to manage leads and prospects have turned to CRM tools for some time. Many varied computer applications, from ACT for the PC to the ultra sophisticated Siebel Systems corporate customer service applications for mainframes can be categorized under this banner.

Small companies looking for CRM solutions under a linux or Mac platform environment first need to consider how long they can operate in a lone-wolf mode. Applications like ACT, although as portable as their PC, and with ACT’s creation of links to Blackberry, Palm and Windows CE, lacked the integration when a second sales person or customer service person joined the force. For the umteenth time, when it comes to using computers, there are two modes, solo and everything else. With contact management and CRM the Cloud is the ideal environment for contact management.

While there are probably sophisticated contact managers for groups using iPhones, we evaluation programs more along the lines of SugarCRM, an intense cloud based prospect and contact manager that has capabilities to manage every phase of prospecting, closing and selling. While SugarCRM can be downloaded and installed on your Mac or Ubuntu PC, it is an ideal candidate for the cloud. It can be scaled to the growth of your organization for less that $ 1000 per year per user and that is a small price compared to the cost of a years salary. For more information on Atlanta ERP visit MSincs Linux and open source ERP and CRM surveys.