Detailed tutorial of python nss module

Keywords: Database SQL Python pip

I usually like making python modules. Recently, I made a module "nss" (which is used for database) and I uploaded it to pypi.
... First, you can download this module with 'pip install nss'. Because the size of the module itself is relatively small and the download is relatively fast, it can be done in two or three seconds (provided that the network speed is fast). The effect is as shown in the figure——

Next, you can import it through 'import nss'!
Next, all the functions in the nss module——
----------------
new_sql(sql_name='default_sql', password='None', existet=False)
Create a database (sql_name: database name; password: password, optional; exist: if True, delete the database with the same name as the database; if False, an error will be reported when there is a database with the same name).
----------------
new_list(sql_name='default_sql', list_name='list0', existet=False, password='None')
Create a form (list name: form name) in SQL name. I won't talk about the others.
----------------
new_position(sql_name='default_sql', list_name='list0', position_name='position0', data='NanShanSQL', password='None')
Create a "location" in the list "name" in SQL "name, that is, a piece of data (position" Name: "location" name; data: stored data). I won't say more about other data.
----------------
cursor(name=1)
Create a cursor.
----------------
open_sql(sql='default_sql', password='None')
Open the database and get the data (the parameters in it have appeared before, so I won't say much).
----------------
change_sql(sql_name='default_sql', list_name='list0', position_name='position0', new_data='NanShanSQL', password='None')
Change the data in position name in list name in SQL name to new data (password: password).
----------------
change_password(sql='default_sql', new_password='None')
Change the password of SQL name to new password.
----------------
export_sql(ea='nssea', sql_name='default_sql', file_position='D:\', password='None')
Use algorithm ea to export SQL name to file position.
----------------
import_sql(file='D:\default_sql.nss', sql_name='default_sql', existet=False, password='None')
Import the file file into the database set and access it.
----------------
new_relation(sql='default_sql', obj1='default_sql\list0\position0', obj2='default_sql\list1\position1', password='None')
Associate obj 1 with obj 2.
----------------
open_relation(sql='default_sql', obj='default_sql\list0\position0', password='None')
Gets the data associated with obj.
----------------
del_sql(sql_name='default_sql', password='None')
Delete the database SQL name.
----------------
del_every_sql()
Delete all databases.
----------------

Next, it is a database program made with nss

import nss as nssql 
def go(*args):
     print('This is a function')
nssql.new_sql('eee',existet=True,password='123456')
print('Create database-eee,The password is"123456"...')
nssql.cursor(6)
print('Building cursors...')
nssql.new_list('eee','aaa',True,password='123456')
print('In database eee Create form in-aaa...')
nssql.new_list('eee','bbb',True,password='123456')
print('In database eee Create form in-bbb...')
nssql.new_position('eee','aaa','qqq','nnn',password='123456')
print('In database eee Form in aaa Create location in-qqq,data-nnn...')
nssql.new_position('eee','aaa','mmm',[1,2,1,4,2,2,3],password='123456')
print('In database eee Form in aaa Create location in-mmm,data-[1,2,1,4,2,2,3]')
nssql.new_position('eee','bbb','zzz',245.3,password='123456')
print('In database eee Form in bbb Create location in-zzz,data-245.3...')
nssql.new_position('eee','bbb','ppp',go,password='123456')
print('In database eee Form in bbb Create location in-ppp,data-function go()...')
nssql.new_relation('eee','eee\\aaa\\qqq','eee\\bbb\\zzz',password='123456')
print('Transferring database eee Form in aaa Position in qqq And database eee Form in bbb Position in zzz Relation...')
i = nssql.open_relation('eee','eee\\aaa\\qqq',password='123456')
print('Finding and database eee Form in aaa Position in qqq Associated location...')
print('The data for this location is:%s' % str(i))
nssql.close_sql('eee')
print('close database-eee...')
i = nssql.open_sql('eee',password='123456')[0]
print('Get database eee Data in...')
print('The data are:%s' % str(i))
i = nssql.open_sql('eee',password='123456')[1]
print('Get database eee Association groups in...')
print('The data are:%s' % str(i))
nssql.change_sql('eee','aaa','mmm',(1,2,2,5,5,5,5,),password='123456')
print('Will database eee Form in aaa Position in mmm Replace with(1,2,2,5,5,5,5,)...')
i = nssql.open_sql('eee',password='123456')[0]
print('Get database eee Data in...')
print('The data are:%s' % str(i))
nssql.export_sql(nssql.NSSea,'eee','',password='123456')
print('Exporting database eee...')
nssql.del_sql('eee',password='123456')
print('Delete database eee...')
nssql.import_sql('eee.nss','eee',True)
print('Importing database file\'eee.nss\'...')
i = nssql.open_sql('eee',password='123456')[0]
print('Get database eee Data in...')
print('The data are:%s' % str(i))
i = nssql.open_sql('eee',password='123456')[0]['bbb']['ppp']
print('Getting database eee Form in bbb Position in ppp Stored functions...')
print('Running function...\n\'\'\'')
i()
print('\'\'\'')
nssql.del_every_sql()
print('Clear all databases...')
print('End of program!')

Effect:

This is my first blog, please give me more guidance!

Published 1 original article, praised 0, visited 8
Private letter follow

Posted by ckdoublenecks on Fri, 28 Feb 2020 03:47:14 -0800