Integer Primary Key won't save the data
So...you want periode to be the primary key _and_ you want it to be the values from 1 -> 60.  Explicitly setting the primary key can be accomplished in a couple of ways...  I'd suggest reading the code for the save() method.

You can `save(force_insert=True)`.  You can manually create and execute an InsertQuery (recommended way).

iq = TableMargin.insert(periode=x, margin=y)
iq.execute()
 OK, so I changed the code and now works as expected (auto insert/update):

``` python
def set_margin(periode, margin):
        query = TabelMargin.select().where(TabelMargin.periode==periode)

        with db_transaction():
            item = first_record(query) or TabelMargin()
            force_insert = item.periode == None
            item.periode = periode
            item.margin = margin
            item.save(force_insert=force_insert)
            return item
```

``` python
class TableMargin(BaseModel):

    class Meta:
        db_table = 'tabel_margin'

    periode = IntegerField(primary_key=True)
    margin = FloatField()

def set_margin(periode, margin):
        query = TabelMargin.select().where(TabelMargin.periode==periode)

        with db_transaction():
            item = first_record(query) or TabelMargin()
            item.periode = periode
            item.margin = margin
            item.save()
            return item

margin = 0.5000
for n in xrange(1, 61):
    margin += 0.0016
    set_margin(n, margin)
```

Code above won't  save the data to database.
Changed to the following structure the results works-well; but I DON'T need the ID field because PERIODE field already unique (it should be a PrimaryKey)

``` python
class TableMargin(BaseModel):

    class Meta:
        db_table = 'tabel_margin'

    periode = IntegerField(unique=True)
    margin = FloatField()
```
