|
39 | 39 | create_mock_engine, |
40 | 40 | inspect, |
41 | 41 | ) |
| 42 | +from sqlalchemy.dialects import mysql |
42 | 43 | from sqlalchemy.engine import Engine |
43 | 44 |
|
44 | 45 | from mlos_bench.util import path_join |
@@ -104,8 +105,8 @@ def __init__(self, engine: Engine | None): |
104 | 105 | Column("git_repo", String(1024), nullable=False), |
105 | 106 | Column("git_commit", String(40), nullable=False), |
106 | 107 | # For backwards compatibility, we allow NULL for ts_start. |
107 | | - Column("ts_start", DateTime), |
108 | | - Column("ts_end", DateTime), |
| 108 | + Column("ts_start", DateTime().with_variant(mysql.DATETIME(fsp=6), "mysql")), |
| 109 | + Column("ts_end", DateTime().with_variant(mysql.DATETIME(fsp=6), "mysql")), |
109 | 110 | # Should match the text IDs of `mlos_bench.environments.Status` enum: |
110 | 111 | # For backwards compatibility, we allow NULL for status. |
111 | 112 | Column("status", String(self._STATUS_LEN)), |
@@ -179,8 +180,16 @@ def __init__(self, engine: Engine | None): |
179 | 180 | Column("trial_id", Integer, nullable=False), |
180 | 181 | Column("config_id", Integer, nullable=False), |
181 | 182 | Column("trial_runner_id", Integer, nullable=True, default=None), |
182 | | - Column("ts_start", DateTime, nullable=False), |
183 | | - Column("ts_end", DateTime), |
| 183 | + Column( |
| 184 | + "ts_start", |
| 185 | + DateTime().with_variant(mysql.DATETIME(fsp=6), "mysql"), |
| 186 | + nullable=False, |
| 187 | + ), |
| 188 | + Column( |
| 189 | + "ts_end", |
| 190 | + DateTime().with_variant(mysql.DATETIME(fsp=6), "mysql"), |
| 191 | + nullable=True, |
| 192 | + ), |
184 | 193 | # Should match the text IDs of `mlos_bench.environments.Status` enum: |
185 | 194 | Column("status", String(self._STATUS_LEN), nullable=False), |
186 | 195 | PrimaryKeyConstraint("exp_id", "trial_id"), |
@@ -232,7 +241,12 @@ def __init__(self, engine: Engine | None): |
232 | 241 | self._meta, |
233 | 242 | Column("exp_id", String(self._ID_LEN), nullable=False), |
234 | 243 | Column("trial_id", Integer, nullable=False), |
235 | | - Column("ts", DateTime(timezone=True), nullable=False, default="now"), |
| 244 | + Column( |
| 245 | + "ts", |
| 246 | + DateTime(timezone=True).with_variant(mysql.DATETIME(fsp=6), "mysql"), |
| 247 | + nullable=False, |
| 248 | + default="now", |
| 249 | + ), |
236 | 250 | Column("status", String(self._STATUS_LEN), nullable=False), |
237 | 251 | UniqueConstraint("exp_id", "trial_id", "ts"), |
238 | 252 | ForeignKeyConstraint( |
@@ -267,7 +281,12 @@ def __init__(self, engine: Engine | None): |
267 | 281 | self._meta, |
268 | 282 | Column("exp_id", String(self._ID_LEN), nullable=False), |
269 | 283 | Column("trial_id", Integer, nullable=False), |
270 | | - Column("ts", DateTime(timezone=True), nullable=False, default="now"), |
| 284 | + Column( |
| 285 | + "ts", |
| 286 | + DateTime(timezone=True).with_variant(mysql.DATETIME(fsp=6), "mysql"), |
| 287 | + nullable=False, |
| 288 | + default="now", |
| 289 | + ), |
271 | 290 | Column("metric_id", String(self._ID_LEN), nullable=False), |
272 | 291 | Column("metric_value", String(self._METRIC_VALUE_LEN)), |
273 | 292 | UniqueConstraint("exp_id", "trial_id", "ts", "metric_id"), |
|
0 commit comments