You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`engine.create_table(table_name, schema)` : Creates a table with the specified Schema.
59
77
78
+
-`engine.drop_db(db_name)` : Drops the database if it exists
79
+
80
+
-`engine.drop_table(tb_name)` : Drops the table if it exists
81
+
82
+
-`engine.fill_table(tb_name, tb_schema, n_rows)` : Fills the table with tb_name as name and tb_schema as schema with n_rows of data. Make sure the provided hooks or custom_functions generate equal to or more than n_rows of data.
83
+
84
+
-`engine.print_table(tb_name)` : It prints the table in pretty format for you to see.
85
+
86
+
-`engine.clear_table(tb_name)` : It removes all the data from the table with provided table name
87
+
88
+
-`engine.close()` : It closes the connection to the database. If not called, the connection will be closed when `engine` object is destroyed.
60
89
61
90
# Schema Functions to specify datatypes
62
-
`Int` - means "INT" of SQL.
63
91
64
-
`Float` - means "Float" of SQL. Doesnt support size and pricision as recommended by the Mysql docs.
92
+
### How to Describe Schema
93
+
> Schema can be describe by using the provided functions which are documented below:
94
+
95
+
1.`Int` - means "INT" of SQL.
96
+
97
+
2.`Float` - means "Float" of SQL. Doesnt support size and pricision as recommended by the Mysql docs.
98
+
99
+
3.`Char` - means "CHAR" of SQL. By default of size 255.
100
+
101
+
4.`VarChar` - means "VARCHAR" of SQL. By default of size 255 # does not take size like in SQL.
65
102
66
-
`Char` - means "CHAR" of SQL. By default of size 255.
103
+
### Equivalent to SQL counterparts
104
+
`Date`, `DateTime`, `Time`, `Timestamp`
67
105
68
-
`VarChar` - means "VARCHAR" of SQL. By default of size 255 # does not take size like in SQL.
106
+
# How Data is Generated
107
+
This module is designed such that the below provided hooks actually are mapped to functions which are responsible for data generation.
69
108
70
-
`Date` - means DATE of sql, `DateTime`, `Time` and `Timestamp`
109
+
Below are the Hooks which can be used to generate data automatically, also Custom Generator functions can be provided which will then be called to generate data.
71
110
72
111
73
-
# Hooks
74
-
### Int/Float
112
+
### Hooks for Int / Float type data
75
113
`random_int` : generates random integers - provide range with arguments
76
114
```python
115
+
# schema description
77
116
tb_name = {
78
-
'age':Int(hook='random_int', args=[10,50])
117
+
'age':Int(hook='random_int', args=(10,50))
79
118
}
80
119
```
81
120
@@ -85,26 +124,26 @@ tb_name = {
85
124
86
125
```python
87
126
schema = {
88
-
'id':Float(hook='random_float', args=[50,200])
127
+
'id':Float(hook='random_float', args=(50,200))
89
128
}
90
129
```
91
130
92
131
`sequence` : generates sequenctial numbers from the range given using `args`.
93
132
94
133
```python
95
134
schema = {
96
-
'id':Int(hook='sequence', args=[50,100])
135
+
'id':Int(hook='sequence', args=(50,100))
97
136
}
98
137
```
99
138
100
139
`random_choice` : Randomly chooses values from a given list
0 commit comments