Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sqlalchemy import create_engine
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy import Column, Integer, String
- from sqlalchemy.orm import sessionmaker
- Base = declarative_base()
- engine = create_engine('postgresql+psycopg2://neko:wakanim@localhost/nekoland')
- Session = sessionmaker(bind=engine)
- session = Session()
- class Guild(Base):
- __tablename__ = 'guild_info'
- id = Column(Integer, primary_key=True)
- name = Column(String)
- description = Column(String)
- image = Column(String)
- color = Column(String)
- lvl = Column(Integer)
- local_rating = Column(Integer)
- global_rating = Column(Integer)
- text_channel = Column(Integer)
- voice_channel = Column(Integer)
- balance = Column(Integer)
- tax = Column(Integer)
- is_private = Column(Boolean, default=True)
- users = relationship("Guild_users", backfer='guild_info')
- def __init__(self, name, description, image, color, lvl, local_rating, global_rating, text_channel, voice_channel, balance, tax, is_private):
- self.name = name
- self.description = description
- self.image = image
- self.color = color
- self.lvl = lvl
- self.local_rating = local_rating
- self.global_rating = global_rating
- self.text_channel = text_channel
- self.voice_channel = voice_channel
- self.balance = balance
- self.tax = tax
- self.is_private = is_private
- def __repr__(self):
- return "<Guild('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')>" % (self.name, self.description, self.image, self.color, self.lvl, self.local_rating, self.global_rating, self.text_channel, self.voice_channel, self.balance, self.tax, self.is_private)
- class Guild_rank(Base):
- __tablename__ = 'guild_rank'
- id = Column(Integer, primary_key=True)
- name = Column(String)
- description = Column(String)
- users = relationship("Guild_users", backfer='guild_rank')
- def __init__(self, name, description):
- self.name = name
- self.description = description
- def __repr__(self):
- return "<Guild_rank('%s', '%s')>" % (self.name, self.description)
- class Guild_users(Base):
- __tablename__ = 'guild_users'
- id = Column(Integer, primary_key=True)
- user_id = Column(Integer)
- guild_id = Column(Integer,ForeignKey('guild_info.id'))
- rank = Column(Integer,ForeignKey('guild_rank.id'))
- def __init__(self, name, is_used, guild_id, rank):
- self.user_id = user_id
- self.guild_id = guild_id
- self.rank = rank
- def __repr__(self):
- return "<Guild_users('%s', '%s', '%s')>" % (self.user_id, self.guild_id, self.rank)
- class Category_commands(Base):
- __tablename__ = 'category_commands'
- id = Column(Integer, primary_key=True)
- name = Column(String)
- description = Column(String)
- commands = relationship("Commands", backfer='category_commands')
- def __init__(self, name, description):
- self.name = name
- self.description = description
- def __repr__(self):
- return "<Category_commands('%s', '%s')>" % (self.name, self.description)
- class Commands(Base):
- __tablename__ = 'commands'
- id = Column(Integer, primary_key=True)
- name = Column(String)
- description = Column(String)
- category = Column(Integer,ForeignKey('category_commands.id'))
- def __init__(self, name, description, category):
- self.name = name
- self.description = description
- self.category = category
- def __repr__(self):
- return "<Commands('%s', '%s', '%s')>" % (self.name, self.description, self.category)
- class Guild_settings(Base):
- __tablename__ = 'guild_settings'
- id = Column(Integer, primary_key=True)
- name = Column(String)
- coefficient = Column(Double)
- def __init__(self, name, coefficient):
- self.name = name
- self.coefficient = coefficient
- def __repr__(self):
- return "<guild_settings('%s', '%s')>" % (self.name, self.coefficient)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement