Code Monkey home page Code Monkey logo

pekeq / nosqlite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from williamstein/nosqlite

1.0 1.0 0.0 274 KB

noSQLite is a lightweight zeroconf noSQL document-oriented forking Python SQLite networked authenticated XMLRPC database server. It's written using Python and SQLite to provide a very lightweight and easy way to use SQLite that offers somewhat similar functionality to MongoDB (at least the parts I use), but much more lightweight

Python 100.00%

nosqlite's People

Contributors

javiermon avatar maxmorais avatar pekeq avatar quigybo avatar sehlen avatar williamstein avatar

Stargazers

 avatar

Watchers

 avatar  avatar

nosqlite's Issues

Unicode cannot be used in many parameters

Unicode cannot be used in many parameters even though it can be used as valid SQL keyword or value.

import unittest
import nosqlite

class Test(unittest.TestCase):
    def setUp(self):
        self.client = nosqlite.Client('.')
        self.database = self.client.memory
        self.collection = self.database.index

    def test_unicode_string(self):
        dummy = nosqlite.client(u'.')

        self.collection.insert({'data': u'111'})
        self.collection.copy(u'collection2')

        self.collection.insert({'a': u'あいうえお'})

        self.collection.find_one(fields=[u'data'])

Phantom field returns when non-exist field was specified.

With this unittest, non-exist field(key3) will be returned.

class Test(unittest.TestCase):
    def setUp(self):
        self.client = nosqlite.Client('.')
        self.database = self.client.memory
        self.collection = self.database.index

    def test_nonexist_field(self):
        collection = self.database.index
        data = {'key1':'val1', 'key2':'val2'}
        collection.insert(data)

        self.assertEqual(data, collection.find_one(key1='val1', fields=['key1','key2','key3']))

SQL error raised when SQL keywords are used in collection or field name

SQL error raised when SQL keywords are used in collection or field name.

import unittest
import nosqlite

class Test(unittest.TestCase):
    def setUp(self):
        self.client = nosqlite.Client('.')
        self.database = self.client.memory
        self.collection = self.database.index

    def test_keyword_escape(self):
        collection = self.database.index

        data = {'index':'index'}

        # insert
        collection.insert(data)

        # find
        self.assertDictEqual(data, collection.find_one(index='index'))
        self.assertDictEqual(data, collection.find_one(index='index', fields=["index"]))

        # update
        collection.update(data, index='index')

        # rename
        collection.rename('table')
        collection.rename('index')

        # copy
        collection.copy('create')

        # delete
        collection.delete(index='index')
        collection.delete()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.