<commit_before>FHR DB
======
Inspired from the blog post http://backchannel.org/blog/friendfeed-schemaless-mysql ,FHR DB is just programmed Layer which enables a MYSQL Database as SQL Database. I skipped some optimizations for better usage from mysql console. I plan in the future to implement this optimizations, but then a sort of PhpMyAdmin for FHR DB is needed, cause if the Datafield are zipped or if we have binary ID, mysql console is just useless.

Why FHR DB?
-----------
During creating an application, you need to create new database fields or delete someone. With FHR DB, you only have to change something at the DB if you want to make this fields searchable. With the FHR DB you can only query indices, that prevents you from coding a slow applications, and provides a lot of flexibility. If you have a mass of data you could easily create new indices on the fly, on a running database, with no perfomance impact. The index will be immediately up, for all new entities, for all old you just need to run the cleaner.

How to use it?
--------------
It's a litte bit like Google Big Table. If you want to create an User Model, the table you have to create looks like this

    ```sql
CREATE TABLE `users` (
  `id` INT(22) NOT NULL auto_increment,
  `body` TEXT NOT NULL,
  `updated` TIMESTAMP NOT NULL,
  `created` TIMESTAMP NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    ```

In the body the json representation of the User is created. In your code you define the User Model like this.

    ```python
class User(Model):
    table = 'users'
    fields = {'nickname' : None, 'password' : <PASSWORD>,
              'email' : { 'confirmed' : False, 'token' : None, 'email' : None, 'sent': False }}
    ```

You can save and get the UserModel like this

```python
user = User({'nickname' : 'notstandard', 'email.email' : '<EMAIL>')
user.set(password='<PASSWORD>')
user.set(email__confirmed=True)
user.set(email__token='Asd',sent=True)
user.put()
print(user.get('id')) # prints out user id for this saved user.
```<commit_msg>markdown<commit_after>FHR DB
======
Inspired from the blog post http://backchannel.org/blog/friendfeed-schemaless-mysql ,FHR DB is just programmed Layer which enables a MYSQL Database as SQL Database. I skipped some optimizations for better usage from mysql console. I plan in the future to implement this optimizations, but then a sort of PhpMyAdmin for FHR DB is needed, cause if the Datafield are zipped or if we have binary ID, mysql console is just useless.

Why FHR DB?
-----------
During creating an application, you need to create new database fields or delete someone. With FHR DB, you only have to change something at the DB if you want to make this fields searchable. With the FHR DB you can only query indices, that prevents you from coding a slow applications, and provides a lot of flexibility. If you have a mass of data you could easily create new indices on the fly, on a running database, with no perfomance impact. The index will be immediately up, for all new entities, for all old you just need to run the cleaner.

How to use it?
--------------
It's a litte bit like Google Big Table. If you want to create an User Model, the table you have to create looks like this

  ```sql
CREATE TABLE `users` (
  `id` INT(22) NOT NULL auto_increment,
  `body` TEXT NOT NULL,
  `updated` TIMESTAMP NOT NULL,
  `created` TIMESTAMP NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  ```

In the body the json representation of the User is created. In your code you define the User Model like this.

  ```python
class User(Model):
    table = 'users'
    fields = {'nickname' : None, 'password' : <PASSWORD>,
              'email' : { 'confirmed' : False, 'token' : None, 'email' : None, 'sent': False }}
  ```

You can save and get the UserModel like this

```python
user = User({'nickname' : 'notstandard', 'email.email' : '<EMAIL>')
user.set(password='<PASSWORD> way to set sometgin')
user.set(email__confirmed=True)
user.set(email__token='Asd',sent=True)
user.put()
print(user.get('id')) # prints out user id for this saved user.
```
{'fraction_non_alphanumeric': 0.0975018190637885, 'fraction_numerical': 0.0014552510308028135, 'mean_word_length': 3.880473372781065, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '280726', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1145, 'n_words': 598}