diff --git a/docs/getting-started/index.rst b/docs/getting-started/index.rst index c6e632c..016f28a 100644 --- a/docs/getting-started/index.rst +++ b/docs/getting-started/index.rst @@ -2,3 +2,9 @@ Getting Started =============== Pylytics v1.0 is significantly improved from v0.7. New documentation will follow shortly. + +.. toctree:: + :maxdepth: 2 + :numbered: + + mysql-configuration diff --git a/docs/getting-started/mysql_configuration.rst b/docs/getting-started/mysql_configuration.rst new file mode 100644 index 0000000..0f0f902 --- /dev/null +++ b/docs/getting-started/mysql_configuration.rst @@ -0,0 +1,10 @@ +MySQL Configuration +=================== + +Pylytics is tested against MySQL 5.5 and 5.6. + +If you are running MySQL 5.6, make sure the server is configured as following:: + + explicit_defaults_for_timestamp=OFF + +This is the default setting for MySQL 5.6, however some cloud providers have it set differently. diff --git a/test/unit/library/test_dimension.py b/test/unit/library/test_dimension.py index bb2ff10..d875415 100644 --- a/test/unit/library/test_dimension.py +++ b/test/unit/library/test_dimension.py @@ -95,3 +95,28 @@ def test_null_values(self, empty_warehouse, store, null_store): Store.insert(store) Store.insert(null_store) assert self._fetch_store_row_count() == 2 + + +class TestAutoTimeStamp(): + """ + The `applicable_from` and `created` columns in the dimension tables default + to the current datetime. This was implemented using triggers. These + tests make sure they're working properly (especially useful for running + these tests across multiple MySQL versions). + + """ + + def test_success(self, empty_warehouse, store): + """ Just check that applicable_from == created_at. + """ + Warehouse.use(empty_warehouse) + Store.build() + Store.insert(store) + connection = Warehouse.get() + with closing(connection.cursor(dictionary=True)) as cursor: + cursor.execute( + "SELECT applicable_from, created FROM %s" % Store.__tablename__ + ) + rows = cursor.fetchall() + assert rows[0]['created'] + assert rows[0]['created'] == rows[0]['applicable_from']