Jump to: navigation, search

Difference between revisions of "Db-string-type-cleanup"

(Starting db-string-type-cleanup bp)
 
(Adding table to db-string-type-cleanup)
Line 8: Line 8:
  
 
Right now, the standard is for developers to use SQLAlchemy's String type directly, where they pass in the desired length.
 
Right now, the standard is for developers to use SQLAlchemy's String type directly, where they pass in the desired length.
 +
 +
 +
 +
{| class="wikitable"
 +
|-
 +
! Count !! Type !! Notes
 +
|-
 +
| 2    || String(12)  || PCI Address
 +
|-
 +
| 2    || String(5)    || Protocol
 +
|-
 +
| 2    || String(8)    || PCI Device Type
 +
|-
 +
| 4    || String(4)    || PCI Vendor/Product IDs
 +
|-
 +
| 5    || String(39)  || IPAddress
 +
|-
 +
| 7    || String(256) || Typos?
 +
|-
 +
| 8    || String(43)  || CIDR
 +
|-
 +
| 56  || String(36)  || UUID
 +
|-
 +
| 388 || String(255) || Generic String
 +
|}
  
 
There are a few problems with this approach:
 
There are a few problems with this approach:
  
 
1. Cumbersome - it requires the developer to specify the exact length each time they a new string column. In most cases, you just want the 'standard' size, so you look around, decide that 255 is most common, and use that.
 
1. Cumbersome - it requires the developer to specify the exact length each time they a new string column. In most cases, you just want the 'standard' size, so you look around, decide that 255 is most common, and use that.
 
  
 
== Design ==
 
== Design ==

Revision as of 00:17, 23 October 2013

Blueprint Name: db-string-type-cleanup

Summary

Rationale

We use String columns as the physical storage for many kinds of logical datatypes, whether it's a UUID as String(36), IPAddress as String(39), or generic strings which are usually String(255).

Right now, the standard is for developers to use SQLAlchemy's String type directly, where they pass in the desired length.


Count Type Notes
2 String(12) PCI Address
2 String(5) Protocol
2 String(8) PCI Device Type
4 String(4) PCI Vendor/Product IDs
5 String(39) IPAddress
7 String(256) Typos?
8 String(43) CIDR
56 String(36) UUID
388 String(255) Generic String

There are a few problems with this approach:

1. Cumbersome - it requires the developer to specify the exact length each time they a new string column. In most cases, you just want the 'standard' size, so you look around, decide that 255 is most common, and use that.

Design