摘要:
1、连接数据库import os,sysPROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))sys.path.insert(0, os.path.join(PROJECT_ROOT, 'lib'))CONFIG_PATH = os.path.join(PROJECT_ROOT,'config.cfg')from sqlalchemy import create_enginefrom sqlalchemy.ext.declarative import declarative_baseimport Co 阅读全文
摘要:
登录数据库 [root@localhost tornado]# psql -U luoyun -d luoyun\c dbname切换数据库,相当于mysql的use dbname\l列举数据库,相当于mysql的show databases\dt列举表,相当于show tables\d tblname查看表结构,相当于desc tblname,show columns from tbnamecreatedb 创建一个新的PostgreSQL的数据库(和SQL语句:CREATE DATABASE 相同)createuser 创建一个新的PostgreSQL的用户(和SQL语句:CREATE U 阅读全文
摘要:
yum installpython-psycopg2yum install libvirt-devel 阅读全文
摘要:
fromsqlalchemy.ext.declarativeimportdeclarative_basefromsqlalchemyimportColumn,Integer,StringfromsqlalchemyimportSequencefromsqlalchemy.ormimportsessionmakerBase=declarative_base()fromsqlalchemyimportcreate_engineengine=create_engine('sqlite:///:memory:',echo=True)classUser(Base):__tablename 阅读全文