Home Database Mysql Tutorial 自定义Hive权限控制(2) 权限配置项目

自定义Hive权限控制(2) 权限配置项目

Jun 10, 2016 pm 03:12 PM
hive control Permissions customize Configuration project

权限配置项目不是这个项目的关键环节,不需要很繁琐。所以我这里使用 django admin进行开发。 django admin只要针对表关系建立相应的对象配置上即可使用。还是比较方便的。 在这里我建立的对象如下: hive 对象相关表 Hive数据库信息 用于存储当前 hive 中的

权限配置项目不是这个项目的关键环节,不需要很繁琐。所以我这里使用django admin进行开发。
django admin只要针对表关系建立相应的对象配置上即可使用。还是比较方便的。
在这里我建立的对象如下:

hive对象相关表
Hive数据库信息 用于存储当前hive中的数据库。
Hive数据库表信息 用于存储当前hive中的表信息。
Hive不允许访问的列信息 用于存储关键列,这个表需要与hive数据库表信息关联。
Hive频道分区信息 用于储存当前hive中表的分区信息。
Hive必须包含的列信息 用于存储当前查询中hive必须包含的特殊列。

权限表
用户HiveServer权限表s 用于将使用者与以上hive对象相关联。

表结构如下:

class HiveDB(models.Model):????id = models.AutoField(primary_key=True)????name = models.CharField(max_length=40,verbose_name=u'数据库名称')????desc = models.CharField(max_length=200,verbose_name=u'描述',null = True, blank = True)????class Meta:????????db_table = u'hive_db'????????verbose_name = u'hive数据库列表'????def __unicode__(self):????????return self.name?class HivePtchannelValue(models.Model):????id = models.AutoField(primary_key=True)????name = models.CharField(max_length=40,verbose_name=u'频道')????desc = models.CharField(max_length=200,verbose_name=u'描述',null = True, blank = True)????class Meta: ????????db_table = u'hive_ptchannel_value'????????verbose_name = u'hive频道分区列表'????def __unicode__(self):????????return self.name?class HiveTable(models.Model): ????id = models.AutoField(primary_key=True)????db = models.ForeignKey(HiveDB)????name =models.CharField(max_length=40,verbose_name=u'表名')????ptinfo = models.CharField(max_length=200,verbose_name=u'分区列',null = True, blank = True)????desc =models.CharField(max_length=200,verbose_name=u'描述',null = True, blank = True)????class Meta:????????db_table = u'hive_table'????????verbose_name = u'hive数据库表列表'????def __unicode__(self): ????????return self.db.name+"."+self.name?class ExcludeColumn(models.Model):????id = models.AutoField(primary_key=True)????name =models.CharField(max_length=40,verbose_name=u'名称')????table = models.ForeignKey(HiveTable)????column =models.CharField(max_length=60,verbose_name=u'列名列表')????desc =models.CharField(max_length=200,verbose_name=u'描述',null = True, blank = True)????class Meta:????????db_table = u'hive_excludecolumn'????????verbose_name = u'hive不允许访问列'????def __unicode__(self):????????return self.table.name+"."+self.name?class IncludeColumn(models.Model):????id = models.AutoField(primary_key=True)????name =models.CharField(max_length=40,verbose_name=u'名称')????table = models.ForeignKey(HiveTable)????column =models.CharField(max_length=60,verbose_name=u'列名列表')????desc =models.CharField(max_length=200,verbose_name=u'描述',null = True, blank = True)????class Meta:????????db_table = u'hive_includecolumn'????????verbose_name = u'hive必须包含列'????def __unicode__(self):????????return self.table.name+"."+self.name?class HiveUserAuth(models.Model):????user = models.ForeignKey(User)????dbGroups = models.ManyToManyField(HiveDB, verbose_name=u'hive数据库', blank=True)????tableGroups = models.ManyToManyField(HiveTable, verbose_name=u'hive数据表', blank=True)????exGroups = models.ManyToManyField(ExcludeColumn, verbose_name=u'hive不包含列', blank=True)????inGroups = models.ManyToManyField(IncludeColumn, verbose_name=u'hive包含列', blank=True)????ptGroups = models.ManyToManyField(HivePtchannelValue, verbose_name=u'频道分区', blank=True)????maxMapCount = models.IntegerField(max_length = 4,blank=True,null=True, verbose_name = u'最大任务分区数')????maxRedCount = models.IntegerField(max_length = 2,blank=True,null=True, verbose_name = u'最大reduce槽位')????class Meta:????????db_table = u'hive_user_auth'????????verbose_name = u'用户HiveServer权限表'????def __unicode__(self):????????return self.user.username
Copy after login

熟悉django的同学可以通过以上方式,很快的构建起一个方便的,安全的web服务。django使用这里就不介绍了,有兴趣的同学可以看一下本博客中关于django的一些介绍。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Enable root permissions with one click (quickly obtain root permissions) Enable root permissions with one click (quickly obtain root permissions) Jun 02, 2024 pm 05:32 PM

It allows users to perform more in-depth operations and customization of the system. Root permission is an administrator permission in the Android system. Obtaining root privileges usually requires a series of tedious steps, which may not be very friendly to ordinary users, however. By enabling root permissions with one click, this article will introduce a simple and effective method to help users easily obtain system permissions. Understand the importance and risks of root permissions and have greater freedom. Root permissions allow users to fully control the mobile phone system. Strengthen security controls, customize themes, and users can delete pre-installed applications. For example, accidentally deleting system files causing system crashes, excessive use of root privileges, and inadvertent installation of malware are also risky, however. Before using root privileges

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Apr 09, 2024 pm 03:20 PM

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

A closer look at PyCharm: a quick way to delete projects A closer look at PyCharm: a quick way to delete projects Feb 26, 2024 pm 04:21 PM

Title: Learn more about PyCharm: An efficient way to delete projects. In recent years, Python, as a powerful and flexible programming language, has been favored by more and more developers. In the development of Python projects, it is crucial to choose an efficient integrated development environment. As a powerful integrated development environment, PyCharm provides Python developers with many convenient functions and tools, including deleting project directories quickly and efficiently. The following will focus on how to use delete in PyCharm

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

The operation process of edius custom screen layout The operation process of edius custom screen layout Mar 27, 2024 pm 06:50 PM

1. The picture below is the default screen layout of edius. The default EDIUS window layout is a horizontal layout. Therefore, in a single-monitor environment, many windows overlap and the preview window is in single-window mode. 2. You can enable [Dual Window Mode] through the [View] menu bar to make the preview window display the playback window and recording window at the same time. 3. You can restore the default screen layout through [View menu bar>Window Layout>General]. In addition, you can also customize the layout that suits you and save it as a commonly used screen layout: drag the window to a layout that suits you, then click [View > Window Layout > Save Current Layout > New], and in the pop-up [Save Current Layout] Layout] enter the layout name in the small window and click OK

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Discuz Forum Permission Management: Read Permission Setting Guide Discuz Forum Permission Management: Read Permission Setting Guide Mar 10, 2024 pm 05:33 PM

Discuz forum permission management: Read the permission setting guide In Discuz forum management, permission setting is a crucial part. Among them, the setting of reading permissions is particularly important, as it determines the scope of content that different users can see in the forum. This article will introduce in detail the reading permission settings of the Discuz forum and how to flexibly configure it for different needs. 1. Basic concepts of reading permissions In the Discuz forum, reading permissions mainly include the following concepts that need to be understood: Default reading permissions: Default after new user registration

See all articles