KnowledgeDB
Knowledge is a polymorphic vertical database based on SQLAlchemy. It provides a dict-like interface to the database.
Knowledge is comprised of two related objects: Fact()s and Entity()s. Entities can be created and then have arbitrary facts applied to them. Before Knowledge can be used, the DB has to be set up with SQLAlchemy as follows:
from sqlalchemy import create_engine
from knowledge.model import init_model, metadata
engine = create_engine('sqlite:///knowledge.db')
init_model(engine)
metadata.create_all(engine)
Using knowledge is easy. Entities are created with a key, then facts about the entity can be applied like values in a dictionary:
from knowledge.model import Entity, DBSession monster = Entity(u'Monster') fairy = Entity(u'Fairy') rjbean = Entity(u'rjbean') monster[u'color'] = u'Green' monster[u'name'] = u'Lotharrr' fairy[u'flies'] = True fairy[u'name'] = u'Bell' rjbean[u'name'] = u'ralph' rjbean[u'flies'] = False rjbean[u'hacks'] = True DBSession.add(monster) DBSession.add(fairy) DBSession.add(rjbean) DBSession.commit()
Retrieving Entities and Facts from the DB works just like any other SQLAlchemy application:
from knowledge.model import Entity, DBSession
# Query all the Entities out of knowledge
knowledge_query = DBSession.query(Entity).all()
for entity in knowledge_query:
print entity, entity.facts.values()
Metadata
Release files for knowledge 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| knowledge-0.3.tar.gz | 7.3 kB | Without provenance | Details for knowledge-0.3.tar.gz |
Release files / knowledge-0.3.tar.gz
| Download URL | knowledge-0.3.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d86d02b626bffd6b70272efd08409575d5849ff83edb4a37032f91050d376da4
|
|
BLAKE2b-256 checksum How to use checksums |
5b95008483ce738869b186cf0d82c5e5340c56dfe30194e4c91ca32609f683c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for knowledge 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.