Saravanan666/pypi-org huggingface dataset:
Package: dbis-btree
Dokumentation zur Nutzung des B-BaumIn der Vorlesung haben Sie B-Bäume kennengelernt.
Dieses Blatt gibt einen kurzen Überblick über ein von uns entwickeltes Python-Tool.Im DBIS Image des Jupyter Hub der RWTH ist dieses Package bereits integriert, falls Sie das Tool lokal benutzen möchten, können Sie diese über den folgenden Befehl installieren:pip install dbis-btree
# in jupyter notebooks:
!pip install dbis-btreeDie folgende Zelle importiert das Python Modul und ermöglicht dessen Nutzung innerhalb des Notebooks:fromdbis_btree.BBaumimportBTreeB-Baum als ObjektAls erstes müssen Sie eine neue Instanz der KlasseBTreeerzeugen. Diesem Objekt werden im weiteren Verlauf Knotennodesund Kantenedgeshinzugefügt.
Geben Sie dieM-Value für den B-Baum an.# zum Beispiel M = 4M=4bbaum=BTree(4)# anzeigen des noch leeren bbaums:bbaum.draw()KnotenNeue Knoten zum Baum hinzufügen:add_node(name, elements)Geben sie dem Knoten eineneindeutigenNamen und die Zahlen, die im Knoten sich befinden sollen.Wenn im Graph schon der Knoten mit diesem Namen existiert, kommt der Fehler:AssertionError:BittenutzeeinenanderenNamefürdieseNode.Konstruktor einer Relation:name: String - Eindeutiger Name des Knotenelements: Int Liste - Liste aus Intbbaum=BTree(4)# hinzufügen Knoten Aname="A"elements=[10,20]bbaum.add_node(name,elements)# hinzufügen Knoten Bbbaum.add_node("B",[1,2])# nicht vergessen, den baum anzuzeigen:bbaum.draw()KantenNeue Knoten zum Baum hinzufügen:add_edge(parent, child, n_child):Dies fügt im Baum eine Kante vomparent-Knoten zumchild-Knoten, an der dern_child-ten Stelle imparent-Knoten.Konstruktor einer Relation:name: String - Eindeutiger Name des Parent Knotenchild: String - Eindeutiger Name des Child Knotenn_child: Int - Position im Parent Knoten.bbaum=BTree(4)# hinzufügen Knoten Aname="A"elements=[10,20]bbaum.add_node(name,elements)# hinzufügen Knoten Bbbaum.add_node("B",[1,2])# hinzufügen einer Kante an 1st StellepositionImParentNode=1bbaum.add_edge("A","B",positionImParentNode)# nicht vergessen, den baum anzuzeigen:bbaum.draw()Häufige Fehler und WarnungenWarning: node A, port f5 unrecognizedbedeutet, dass eine falsche Zahl beim Parametern_childgenutzt wurde.add_edge(parent, child, n_child):In unserem Fall wurde dieser Fehler wurde ausgelöst, als eine Kante an Stelle 5 in Knoten A hinzugefügt wurde. Jedoch besaß A nur insgesamt Stellen 1 bis 4 um Kanten hinzuzufügen.
Package: dbis-exc-manager
DBIS Exercise ManagerThis class manages the state of the exercises.
Example for arguments:
ÜB 1, Aufgabe 2.3 a), 2 Punkteexc = 1task = 2subtask = 3a)points = 2Example usage:exc=Exercise(1)task1=Task(exc,task=1,subtask="2 a)",points=2)
Package: dbis-relational-algebra-exercise-generator
DBIS Relational Algebra Exercise GeneratorThis library generates relational algebra exercises based on thedbis-relational-algebralibrary.InstallationInstall via pip:pipinstalldbis-relational-algebra-exercise-generatorMost notably, following required packages are also installed:dbis-relational-algebradbis-exc-managerUsagefromra_exercise_generatorimportgenerate_exercisefromrelational_algebraimport*solution_algebra_expression=Projection("R",("R.a","R.c"))fromexcmanager.TaskimportExercise,Task,SubTaskexercise1=Exercise(1)task1=Task(exercise1,"1.1")subtask1=SubTask(task1,"a",points=2)# task descriptiondescription="Select the attributes a and c from the relation R."generated_cells=generate_exercise(subtask1,description,solution_algebra_expression,correct_attributes_score_perc=0.1)# generated_cells is a dictionary of cells, which can be used to generate a Jupyter Notebook# format:# filename (str) -> cell content (str):warning: GuidelinesIn order to directly use the generated cells in an exercise Jupyter notebook, one should follow the following guidelines:tasksshould be namedtask1,task2, ...The SQLite Connection has to be made beforehand. This connection should be stored in the variablesql_con.View thetemplatesandthis testfor more information on what cells are generated and how one can incorporate them into an exercise Jupyter notebook.
Package: dbis-relational-calculus-exercise-generator
DBIS Relational Calculus Exercise GeneratorThis library generates relational calculus exercises based on thedbis-relational-calculuslibrary.InstallationInstall via pip:pipinstalldbis-relational-calculus-exercise-generatorMost notably, following required packages are also installed:dbis-relational-calculusdbis-exc-managerUsagefromrc_exercise_generatorimportgenerate_exercise# set the solution, either SQLite query (string), or TupleCalculus / DomainCalculus objectsolution_sql_query="SELECT a, c FROM R;"fromexcmanager.TaskimportExercise,Task,SubTaskexercise1=Exercise(1)task1=Task(exercise1,"1.1")subtask1=SubTask(task1,"a",points=2)# task descriptiondescription="Select the attributes a and c from the relation R."generated_cells=generate_exercise(subtask1,description,solution_sql_query,correct_attributes_score_perc=0.1,calculus_type="tuple"# the student should submit a TupleCalculus solution)# generated_cells is a dictionary of cells, which can be used to generate a Jupyter Notebook# format:# filename (str) -> cell content (str):warning: GuidelinesIn order to directly use the generated cells in an exercise Jupyter notebook, one should follow the following guidelines:tasksshould be namedtask1,task2, ...The SQLite Connection has to be made beforehand. This connection should be stored in the variablesql_con.View thetemplatesandthis testfor more information on what cells are generated and how one can incorporate them into an exercise Jupyter notebook.
Package: dbis-schema-creator
DBIS Schema CreatorCreate a schema for SQLite databases and populate it using object-oriented programming. Also draw the correspondinger-diagram.Installationpipinstalldbis-schema-creatorUsagefromschema_creatorimport*fromerdiagramimportERfromfakerimportFakerfake=Faker()# Create a Table object (sqlalchemy style)classUsers(Table):# Create tablesuser_id=Column(Integer,primary_key=True)username=Column(String(50))# Optionally set the table name. Default is the lowercase class name__tablename__='users'# Specify how to populate the table (e.g., using faker or random)defpopulate(session,seed=None):for_inrange(100):user=Users(username=fake.name())session.add(user)# Specify how to draw the er-diagramdefto_er_diagram():g=ER()g.add_node("User")g.add_attribute("User","user_id",isPK=True)g.add_attribute("User","username")returngclassPosts(Table):post_id=Column(Integer,primary_key=True)user_id=Column(Integer,ForeignKey('users.user_id'))text=Column(String(1000))depedencies={Users}# specify the tables that this table depends on. Default is nonedefpopulate(session,seed=None):# get already populated user tableusers=session.query(Users).all()for_inrange(1000):user=random.choice(users)post=Posts(user_id=user.user_id,text=fake.text())session.add(post)defto_er_diagram():g=ER()g.add_node("Post",isWeak=True)g.add_attribute("Post","post_id",isPK=True,isWeak=True)g.add_attribute("Post","user_id")g.add_attribute("Post","text")g.add_relation("User","posts","Post","1","m",isWeak=True)returng# Create the schema factorytables={Users,Posts}factory=SchemaFactory(tables)# populate the tablefactory.populate()# create the schemaschema=factory.to_sql()# create the er-diagramer_diagram=factory.to_er_diagram()# draw the er diagramdigraph=er_diagram.draw()digraph.render('er-diagram',format='png',view=True)
Package: dbis-sql-exercise-generator
DBIS SQL Exercise GeneratorInstallationInstall via pip:# Not yet available on PyPIpipinstalldbis-sql-exercise-generatorMost notably, following required packages are also installed:dbis-sqldbis-exc-managerUsagefromrc_exercise_generatorimportgenerate_exercise# set the solution as SQLite query (string)solution_sql_query="SELECT a, c FROM R;"fromexcmanager.TaskimportExercise,Task,SubTaskexercise1=Exercise(1)task1=Task(exercise1,"1.1")subtask1=SubTask(task1,"a",points=2)# task descriptiondescription="Select the attributes a and c from the relation R."generated_cells=generate_exercise(subtask1,description,solution_sql_query,correct_attributes_score_perc=0.1,)# generated_cells is a dictionary of cells, which can be used to generate a Jupyter Notebook# format:# filename (str) -> cell content (str):warning: GuidelinesIn order to directly use the generated cells in an exercise Jupyter notebook, one should follow the following guidelines:tasksshould be namedtask1,task2, ...The SQLite Connection has to be made beforehand. This connection should be stored in the variablesql_con.View thetemplatesandthis testfor more information on what cells are generated and how one can incorporate them into an exercise Jupyter notebook.
Package: dbix
dbixload a perl DBIx::Class schema with pythonWHAT IS DBIx::Class ?DBIx::Class (also known as DBIC) is an extensible and
flexible Object/Relational Mapper (ORM) written in Perl.
ORMs speed development, abstract data and make it pole,
allow you to represent your business rules through OO code
and generate boilerplate code for CRUD operations.seehttp://www.dbix-class.org/since perl syntax is quite complex,
the input schema might need a few adjustments.this code does correctly convert the examples
included in the tests/schema and tests/example,
both original schemas taken from the wild.psycopg2 is needed for postgresql databases.
MySQL-python is needed for mysql databases.Free software: Apache Software License 2.0Documentation:https://dbix.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2017-10-08)First release on PyPI.
Package: db-join
db-joinI realized during my personal journey using Google Datastore that I was doing something
very often on a set of DB entities.  That is, I had foreign key references on various
fields in an entity and wanted to load the entities refenced by those keys.  Additionally,
I wanted to control which entities are loaded with some syntactic sugar and I wanted to
do it efficienntly.Hence the birth of db-join -- a NoSQL version of join semantics you get with a SQL db.BasicsFirst, create an instance of ajoiner.  Right now, onlyDatastoreJoinclass exists
but I hope overtime other NoSQL dbs wrappers can be added.>>> import join
>>> joiner = join.api.DatastoreJoin()Next, given a iterable (typically via query),joinagainst all the fields you wish.>>> iterable = joiner(client, iterable, ('field1', 'field2'))What this does is discovers if the DB keys referenced byfield1andfield2(if any)
and does aget_multion this keys and themutatesthe db object with those discovered
entities.  Thus, after the join bothfield1andfield2will refer to entities (instead
of keys) assuming they are in fact keys and those keys do in fact refer to db entities.Dotted notationThese fields may actually be dotted patterns as documented in thedotted-notationpackage.  Dotted notation permits you to fetch an item inside a deeply nested
datastructure.>>> d = {'hello': {'there': [{'a': 1, 'b': 2}, {'a': 7, 'b': 8}]}}
>>> dotted.get(d, 'hello.there[1].b') == 8Thus, if your DB entity has a list of keys OR something nested you can specify how to
fetch it.  For example,>>> joiner(client, iterable, 'list_of_keys[*]')This will join on all keys contained in a list referenced bylist_of_keys.ChainingBut that's not all.  Apatternmay also use chaining notation:>>> joiner(client, iterable, 'field1->another_field')This will fetch the object atfield1and then fetch that object's the object atanother_field.ReplacingTurns out sometimes you want to replace the object with a referenced object.  The!operator lets you do this:>>> joiner(client, iterable, '!field1')This will replace the object at yielded by iterable with whatever object was found
atfield1.  Note that this works with chaining as well.>>> joiner(client, iterable, 'field1->!symlink')This will replacefield1with whatever was found insymlink.Recursive chainingSimilar to replacing, sometimes you want to recursively expand objects that are linked
via the same field.  The+operator lets you do this:>>> joiner(client, iterable, '+field')This will fetch the object atfield. If that object also hasfield, then it will
fetch the object at that object'sfieldand so on until there's no more work.InternalsAJoinclass has a number of abstractions to help you out.  The two most important are
thegetterand thesetter.  These methods are called whenever you're getting a value
of a field that matchespatternand when you're setting that value.The default behavior is to just usedotted.getanddotted.updaterespectively.
Package: dbjson
Getting started with DBJsonfromdbjson.mainimportDB# Instatilizing DB class from dbjson.maindb=DB()# Test Datadata={"id":1,"first_name":"Vivyan","last_name":"Treherne","email":"vtreherne0@jigsy.com","ip_address":"94.254.247.240"}collection="users"# Adding Recorddata=db.createRecord(collection,data)print(data)# Response -> {'__id__': 'f00ae4e3ca8c3e318a68acc460e5f401', '__data__': {'id': 1, 'first_name': 'Vivyan', 'last_name': 'Treherne', 'email': 'vtreherne0@jigsy.com', 'ip_address': '94.254.247.240'}}# Updating Recordrecord_key="f00ae4e3ca8c3e318a68acc460e5f401"to_update=[{"email":"jhon@email.com"},{"ip_address":"google.com"}]data=db.updateRecord(collection,"f00ae4e3ca8c3e318a68acc460e5f401",to_update)print(data)# Response -> {'id': 1, 'first_name': 'Vivyan', 'last_name': 'Treherne', 'email': 'jhon@email.com', 'ip_address': 'google.com'}# Deleting Recorddb.removeRecord(collection,record_key)What is DBJson?Read theDBJson docs here.This is a simple flat file database which stores its data in filesystem ( folders and JSONfiles ).
It is NOT INTENTED TO USE IN PRODUCTION.
It can be used times when you are too lazy to write a schema and do other stuff for a ORM like SQLAlchemy.Data is structured as follows:Collections : contains records.
records: contains key value pair.
key value pair ( key: str, value: dictionary ).What are its features ?It can CRUD data.
It is ACID Compliant.What can it Do ?It can do all the basic things that a database can do, which includes:creating recordsreading recordsupdating recordsdeleting recordsfilter recordsWhy was it made ?Sometimes I am to lazy to setup database make database models and all that stuff, and I like key-value pair databases for small fun projects. So I could not find in python so I decided to make one for myself.Hope you guys like it.😊Read theDBJson docs here.
Package: dbjsonpy
DBjsoncrud operation with database using json.Featurescreate data.read data.delete dataupdate datasearch dataInstallpipinstalldbjsonpyExampleminimal examplefromdbjsonimportDBjsondb=DBjson('sqlite:///test.db')classUser(db.Model):name=db.Column(db.String)# insert dataadd_data={"name":"Jak","city":"india"}print(db.add(User,add_data))# read all dataprint(db.get_all(User))see full examplehereTodoupdate dataadd multiple datasearch datapaginate data
Package: db-kirosake
DescriptionAn easy-to-use cloud database that uses a GitHub repository to store
data. # Example Using an example, I will show you how to create a
database for a Discord server using pycordimportdiscordfromdiscord.extimportcommands,tasksimportjsonfromdb_kirosakeimportdbkirosakefromsettings.configimport*DB=dbkirosake.DBKirosake(actoken,# access token your GitHub accountrepos# your private/public repository)intents=discord.Intents.all()client=commands.Bot(command_prefix=prefix,intents=intents,bot=True)client.remove_command('help')@client.eventasyncdefon_ready():forguildinclient.guilds:formemberinguild.members:db={'lvl':1,'cash':10}awaitDB.create_db(nameDB='test',folder=guild.id,ids=member.id,database=db)client.run(token)A database is created with the namenameDBwhich contains a folder
calledguild.idand fileusers.jsonStructure../test/1234567890/users.jsonThe users.json file contains
the list:{"here ids":{"lvl":1,"cash":10}}Data updateDB=DBKirosake(actoken,repos)awaitDB.insert_one(nameDB='test',folder="1234567890",ids="0987654321",insert='lvl',value=5,method='r'#r or a; replace or add)Get dictionarydict=awaitDB.get(nameDB='test',folder="1234567890",ids="0987654321")print(dict)
Package: dbkit
dbkitis a library that abstracts away at least part of the pain
involved in dealing withDB-API 2compatible database drivers.Here’s an example:from dbkit import connect, query
from contextlib import closing
import sqlite3

with connect(sqlite3, 'counters.db') as ctx, closing(ctx):
    for counter, value in query('SELECT counter, value FROM counters'):
        print "%s: %d" % (counter, value)Overviewdbkitis intended to be used in circumstances where it is impractical
or overkill to use an ORM such asSQLObjectorSQLAlchemy, but it
would be useful to at least abstract away some of the pain involved in
dealing with the database.Features:Rather than passing around database connections, statements are executed
within a databasecontext, thus helping to decouple modules that
interface with the database from the database itself and its connection
details.Database contexts contain references to the exceptions exposed by the
database driver, thus decoupling exception handling from the database
driver.Easier to use transaction handling.Easier iteration over resultsets.Connection pooling. In addition, any code using pooled connections has
no need to know connection pooling is in place.Query logging.Non-aims:Abstraction of SQL statements. The idea is to get rid of the more
annoying but necessary boilerplate code involved in dealing withDB-API 2drivers, not to totally abstract away SQL itself.Installationdbkitcan be installed with either eitherpip(recommended):$ pip install dbkitOr witheasy_install:$ easy_install dbkitDevelopmentThe repos can be found onGithubwhile
the documentation can be found onRead the Docs.Change history0.2.4 (2015-11-30)Python 3 support.0.2.3 (2015-11-26)Context.cursor()now always creates a transaction. The lack of this outer
transaction meant that PostgreSQL would end up with a large number of idle
transactions that had neither been committed or rolled back.0.2.2 (2013-04-04)Scrapunindent_statement().Derive all dbkit exceptions fromException.Clean up connection pinging code.Addmake_placeholders()for generating statement placeholders safely.Addto_dict()for converting resultsets to dicts mapped off of a
particular field.0.2.0 (2012-10-16)Addlast_row_id().Pools now can have custom mediators.Cursors are now tracked.Pooled connections are no longer closed prematurely.Row factories are now usable outside of context safely.0.1.4 (2012-10-11)execute*()now returns the number of affected rows.Addlast_row_countandlast_row_idtoContext.RemoveDummyPoolandThreadAffinePool, though the latter may be
returning.Stablise the behaviour ofPoolwhen dealing with expired connections.Documentation version is now pegged directly to the library.0.1.2 (2012-09-02)Initial revision with a changelog.
Package: dbleupy
dbleupyThis package offers you a more user friendly and easier way to interact with the discord-botlist.eu HTTP api.InstallingPython 3.4 or higher is required- In the example py-cord was used, but other libs can be used as well.To install the library you can just run the following command:pip install dbleupyQuick Example (belongs in the on_ready event)from dbleupy import dbleu_postservercount, dbleu_getbotvotes, dbleu_getbotdata

dbleuKEY = "APIKEY" # Get it from https://dev.discord-botlist.eu

r = dbleu_getbotvotes(dbleuKEY, log_disable=False/True)
print(r.content)
# GET ALL BOT VOTES

r = dbleu_getbotdata(dbleuKEY, log_disable=False/True)
print(r.content)
# GET BOTDATA

dbleu_postservercount(dbleuKEY, bot/self.bot)
# POST SERVERCOUNT 
# IMPORTANT: The second parameter must be the discord.ext.commands.bot.Bot objectExample with auto postfrom dbleupy import dbleu_postservercount, dbleu_getbotvotes, dbleu_getbotdata
from discord.ext import tasks

dbleuKEY = "APIKEY" # Get it from https://dev.discord-botlist.eu

r = dbleu_getbotvotes(dbleuKEY, log_disable=False/True)
print(r.content)
# GET ALL BOT VOTES

r = dbleu_getbotdata(dbleuKEY, log_disable=False/True)
print(r.content)
# GET BOTDATA

@tasks.loop(minutes=5)
async def auto_post():
    dbleu_postservercount(dbleuKEY, bot/self.bot, log_disable=False/True)
    # IMPORTANT: The second parameter must be the discord.ext.commands.bot.Bot object

auto_post.start()
# POST SERVERCOUNT every 5 mins.LinksDocumentation:https://docs.discord-botlist.euOfficial Website:https://discord-botlist.euOfficial Discord Server:https://discord.gg/FR3cA5dWK6Discord-botlist.eu Developers:https://dev.discord-botlist.eu
Package: dblinea
LIneA Database LibraryPython library to access LIneA's database from Python code.
Useful to retrieve data inside LIneA's JupyterHub platform.Authors@glaubervila@gschwendInstallationInstalldblineawith pippipinstalldblineaRequirementssqlalchemy>=1.4.25psycopg2>=2.9.1numpy>=1.19.4pandas>=1.2.0astropy>=5.0.0pipinstallsqlalchemypsycopg2numpypandasastropyFuture plansSub-package to allow users to send user-generated data products to LIneA Science Server (e.g., a list of targets for visual inspection).DevelopmentPython 3.8:https://tecadmin.net/install-python-3-8-ubuntu/Dependencias:sudoapt-getinstalllibreadline-gplv2-devlibncursesw5-devlibssl-devlibsqlite3-devtk-devlibgdbm-devlibc6-devlibbz2-devlibffi-devzlib1g-devliblzma-devpython3.8-mvenvvenvsourcevenv/bin/activate
pipinstall--upgradepippipinstallwheelsetuptoolstwinepytestpytest-runnerpytest-covblackExecutar os testes:pythonsetup.pypytest--cov--cov-reportterm-missing--cov-reporthtmlFazer o Build:https://medium.com/analytics-vidhya/how-to-create-a-python-library-7d5aea80cc3fpythonsetup.pysdistbdist_wheelTestando o pacote apos o buildpython3.8-mvenvvenvsourcevenv/bin/activatepipinstallsqlalchemypsycopg2numpypandasastropyPara instalar usando o pacote localpipinstall--force-reinstall<path>/dist/wheelfile.whlAbrir um terminal e importar a classe DBBase. ou utilizar o comando.python-c'from dblinea import DBBase'Outro Teste(env)glauber:~$python
Python3.8.12(default,Jan282022,15:50:21)[GCC7.5.0]onlinux
Type"help","copyright","credits"or"license"formoreinformation.
>>>fromdblineaimportDBBase
>>>a=DBBase()>>>a.get_engine()Engine(postgresql+psycopg2://untrustedprod:***@desdb4.linea.gov.br:5432/prod_gavo)>>>Publish in PyPi TestCheck if build is ok for publishpython-mtwinecheckdist/*python-mtwineupload--verbose--repositorytestpypidist/*Check inhttps://test.pypi.org/manage/project/dblinea/releases/Publish in PyPi Oficialhttps://realpython.com/pypi-publish-python-package/twineuploaddist/*Executar o Lint em busca de errors de sintaxe ou formatação.black.--checkExecutar o Lint para corrigir automaticamente os errors encontrados.black.Documentation with sphinxGenerate Api Docscddocs
sphinx-apidoc-f-o./source../dblineaBuild html docsmakehtmlTODO: Trocar Coveralls por codecovhttps://about.codecov.io/