diff options
| author | Andrew <saintruler@gmail.com> | 2019-07-06 14:36:55 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2019-07-06 14:36:55 +0400 |
| commit | 1e6967f8c4f1ef64947d7f2b95268339d78db454 (patch) | |
| tree | b2ebf1ccb160e3c58f277dfec4bae8f83b03ec45 /day9/task5/database.py | |
| parent | f1a923860c02c69d9e67d15da24f90d7306223e0 (diff) | |
WIP: Изменена структура сервера.
Diffstat (limited to 'day9/task5/database.py')
| -rw-r--r-- | day9/task5/database.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/day9/task5/database.py b/day9/task5/database.py new file mode 100644 index 0000000..067c481 --- /dev/null +++ b/day9/task5/database.py @@ -0,0 +1,29 @@ +import MySQLdb +from config import * + + +# В файле config.py создайте соответствующие переменные +db = MySQLdb.connect( + host=HOST, + user=USERNAME, + passwd=PASSWORD, + db=DATABASE_NAME +) + +db.cursor().execute( + ''' + CREATE TABLE IF NOT EXISTS `table_task1` ( + `service_id` int(11) NOT NULL AUTO_INCREMENT, + `servtype` varchar(20) NOT NULL DEFAULT 'hosting', + `subtype` varchar(32) NOT NULL DEFAULT '', + `user_id` bigint(20) NOT NULL, + `referrer_user_id` bigint(20) NOT NULL, + `state` varchar(1) NOT NULL DEFAULT 'N', + `creation_date` date NOT NULL DEFAULT '0000-01-01', + `creation_time` time NOT NULL DEFAULT '00:00:00', + `creation_request_sent_date` datetime DEFAULT NULL, + `notified_about_expiration` smallint(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`service_id`) + ) ENGINE=InnoDB AUTO_INCREMENT=35109400 DEFAULT CHARSET=utf8; + ''' +)
\ No newline at end of file |