(self)
| 100 | |
| 101 | class ReadSQLTable: |
| 102 | def setup(self): |
| 103 | N = 10000 |
| 104 | self.table_name = "test" |
| 105 | self.con = create_engine("sqlite:///:memory:") |
| 106 | self.df = DataFrame( |
| 107 | { |
| 108 | "float": np.random.randn(N), |
| 109 | "float_with_nan": np.random.randn(N), |
| 110 | "string": ["foo"] * N, |
| 111 | "bool": [True] * N, |
| 112 | "int": np.random.randint(0, N, size=N), |
| 113 | "datetime": date_range("2000-01-01", periods=N, freq="s"), |
| 114 | }, |
| 115 | index=Index([f"i-{i}" for i in range(N)], dtype=object), |
| 116 | ) |
| 117 | self.df.iloc[1000:3000, 1] = np.nan |
| 118 | self.df["date"] = self.df["datetime"].dt.date |
| 119 | self.df["time"] = self.df["datetime"].dt.time |
| 120 | self.df["datetime_string"] = self.df["datetime"].astype(str) |
| 121 | self.df.to_sql(self.table_name, self.con, if_exists="replace") |
| 122 | |
| 123 | def time_read_sql_table_all(self): |
| 124 | read_sql_table(self.table_name, self.con) |
nothing calls this directly
no test coverage detected