Custom Hive permission Control (2) Permission configuration project

Source: Internet
Author: User
The permission configuration project is not a key part of this project and does not need to be cumbersome. So here I use djangoadmin for development. Djangoadmin only needs to configure the corresponding object for the table relationship. It is more convenient. Here, the created object is as follows: hive object-related table Hive database information is used to store the information in the current hive

The permission configuration project is not a key part of this project and does not need to be cumbersome. So here I use django admin for development. Django admin only needs to configure the corresponding object for the table relationship. It is more convenient. Here, the created object is as follows: hive object-related table Hive database information is used to store the information in the current hive

The permission configuration project is not a key part of this project and does not need to be cumbersome. So here I use django admin for development.
Django admin only needs to configure the corresponding object for the table relationship. It is more convenient.
Here, the object I created is as follows:

Hive object table
Hive database information is used to store the current database in hive.
The Hive database table information is used to store the table information in the current hive.
The column information that Hive does not allow access is used to store key columns. This table must be associated with the hive database table information.
The Hive channel partition information is used to store the partition information of the current hive table.
The column information that must be included in Hive is used to store the special columns that must be included in hive in the current query.

Permission table
User HiveServer permission table s is used to associate a user with the above hive object.

The table structure is as follows:

Class HiveDB (models. Model ):???? Id = models. AutoField (primary_key = True )???? Name = models. CharField (max_length = 40, verbose_name = u'database name ')???? Desc = models. CharField (max_length = 200, verbose_name = u'description', null = True, blank = True )???? Class Meta :???????? Db_table = u'hive _ db '???????? Verbose_name = u'hive database list '???? 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'channel ')???? Desc = models. CharField (max_length = 200, verbose_name = u'description', null = True, blank = True )???? Class Meta :???????? Db_table = u'hive _ ptchannel_value '???????? Verbose_name = u'hive channel partition list '???? 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'table name ')???? Ptinfo = models. CharField (max_length = 200, verbose_name = u'partition column', null = True, blank = True )???? Desc = models. CharField (max_length = 200, verbose_name = u'description', null = True, blank = True )???? Class Meta :???????? Db_table = u'hive _ table '???????? Verbose_name = u'hive database table list '???? 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'name ')???? Table = models. ForeignKey (HiveTable )???? Column = models. CharField (max_length = 60, verbose_name = u'column name list ')???? Desc = models. CharField (max_length = 200, verbose_name = u'description', null = True, blank = True )???? Class Meta :???????? Db_table = u'hive _ excludecolumn '???????? Verbose_name = u'hive does not allow access to columns '???? 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'name ')???? Table = models. ForeignKey (HiveTable )???? Column = models. CharField (max_length = 60, verbose_name = u'column name list ')???? Desc = models. CharField (max_length = 200, verbose_name = u'description', null = True, blank = True )???? Class Meta :???????? Db_table = u'hive _ includecolumn '???????? Verbose_name = u'hive must contain the column '???? 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 database', blank = True )???? TableGroups = models. ManyToManyField (HiveTable, verbose_name = u 'hive data table ', blank = True )???? ExGroups = models. ManyToManyField (ExcludeColumn, verbose_name = u'hive does not contain column', blank = True )???? InGroups = models. ManyToManyField (IncludeColumn, verbose_name = u'hive includes columns ', blank = True )???? PtGroups = models. ManyToManyField (HivePtchannelValue, verbose_name = u'channel partition', blank = True )???? MaxMapCount = models. IntegerField (max_length = 4, blank = True, null = True, verbose_name = u'maximum number of task partitions ')???? MaxRedCount = models. IntegerField (max_length = 2, blank = True, null = True, verbose_name = u 'maximum reduce slot ')???? Class Meta :???????? Db_table = u'hive _ user_auth '???????? Verbose_name = u'user HiveServer permission table '???? Def _ unicode _ (self ):???????? Return self. user. username

Those familiar with django can quickly build a convenient and secure web Service through the above methods. I will not introduce django here. If you are interested, you can take a look at some introductions about django in this blog.

Original article address: Custom Hive permission Control (2) Permission configuration project. Thanks to the original author for sharing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.