mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
Update database operation
This commit is contained in:
parent
577ee06710
commit
7d18b6b019
17
README.md
17
README.md
@ -8,3 +8,20 @@
|
||||
- `conda install faiss-gpu cuda90 -c pytorch # For CUDA9.0`
|
||||
- `conda install flask`
|
||||
- `pip install flask-restful`
|
||||
|
||||
### Create Database
|
||||
|
||||
- Install MySQL
|
||||
- `sudo apt-get update`
|
||||
- `sudo apt-get install mariadb-server`
|
||||
|
||||
- Create user and database:
|
||||
- `create user vecwise;`
|
||||
- `create database vecdata;`
|
||||
- `grant all privileges on vecdata.* to 'vecwise'@'%';`
|
||||
- `flush privileges;`
|
||||
|
||||
- Create table:
|
||||
- `python` # enter python3 interaction environment
|
||||
- `from engine import db`
|
||||
- `db.create_all()`
|
||||
|
@ -10,6 +10,7 @@ app.config.from_object('engine.settings')
|
||||
print ("Create database instance")
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
from engine.model.IndexTable import IndexTable
|
||||
from engine.model.GroupTable import GroupTable
|
||||
from engine.model.FileTable import FileTable
|
||||
|
||||
from engine.controller import IndexManage
|
||||
|
18
pyengine/engine/model/FileTable.py
Normal file
18
pyengine/engine/model/FileTable.py
Normal file
@ -0,0 +1,18 @@
|
||||
from engine import db
|
||||
|
||||
class FileTable(db.Model):
|
||||
__tablename__ = 'file_table'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
group_name = db.Column(db.String(100))
|
||||
filename = db.Column(db.String(100))
|
||||
type = (db.Integer)
|
||||
row_number = db.Column(db.Integer)
|
||||
|
||||
def __init__(self, group_name, filename, type):
|
||||
self.group_name = group_name
|
||||
self.filename = filename
|
||||
self.type = type
|
||||
self.row_number = 0
|
||||
|
||||
def __repr__(self):
|
||||
return '<FileTable $r>' % self.tablename
|
14
pyengine/engine/model/GroupTable.py
Normal file
14
pyengine/engine/model/GroupTable.py
Normal file
@ -0,0 +1,14 @@
|
||||
from engine import db
|
||||
|
||||
class GroupTable(db.Model):
|
||||
__tablename__ = 'group_table'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
group_name = db.Column(db.String(100))
|
||||
file_number = db.Column(db.Integer)
|
||||
|
||||
def __init__(self, group_name):
|
||||
self.group_name = group_name
|
||||
self.file_number = 0
|
||||
|
||||
def __repr__(self):
|
||||
return '<GroupTable $r>' % self.group_name
|
@ -1,16 +0,0 @@
|
||||
from engine import db
|
||||
|
||||
class IndexTable(db.Model):
|
||||
__tablename__ = 'index_table'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
tablename = db.Column(db.String(100))
|
||||
filename = db.Column(db.String(100))
|
||||
type = (db.Integer)
|
||||
|
||||
def __init__(self, tablename, filename, type):
|
||||
self.tablename = tablename
|
||||
self.filename = filename
|
||||
self.type = type
|
||||
|
||||
def __repr__(self):
|
||||
return '<IndexTable $r>' % self.tablename
|
@ -2,5 +2,5 @@
|
||||
|
||||
DEBUG = True
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
SECRET_KEY='A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
SQLALCHEMY_DATABASE_URI = "mysql://user:passwd@ip:port/BLOG_DB"
|
||||
# SECRET_KEY='A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://vecwise@127.0.0.1:3306/vecdata"
|
Loading…
Reference in New Issue
Block a user