Skip to main content

No project description provided

Project description

SQLite


Installation

pip3 install Surfy.SQLite

Usage

from sqlite import DB

db = DB('PATH_TO_FILE')

Methods

.query(query)

result = db.query('''CREATE TABLE IF NOT EXISTS test_table
	(id INTEGER PRIMARY KEY AUTOINCREMENT,
	createTime TEXT,
	data TEXT COLLATE NOCASE,
	extradata TEXT,
	counter INTEGER,
	realNumber REAL,
	object TEXT,
	array TEXT);''')

.table(table_name)

testTable = db.table('test_table')

table.insertOne(row)

Inserts a single row into a table

insertedID = testTable.insertOne({
	'createTime': 'CURRENT_TIME',
	'data': 'Some Data 1',
	'extradata': 'Some Extra Data',
	'counter': 2,
	'realNumber': 2.52,
	'object': {
		'field': 'value'
	},
	'array': [1,2,3]
})

table.insert(rows)

Inserts data into a table

insertedIDs = testTable.insert(
	[
		{
			'createTime': 'CURRENT_TIME', 'data': 'Some Data 1'
		},
		{
			'createTime': 'CURRENT_TIME', 'data': 'Some Data 2'
		},
		{
			'createTime': 'CURRENT_TIME', 'data': 'Some Data 3'
		}
	]
)

table.findOne(match, options)

Finds one row in a table

match = {
	'data': 'Some Data 2'
}

options = {
	'fields': ['id', 'currentTime', 'data']
}

result = testTable.findOne(match, options)

'''

result {
	'id': 3,
	'currentTime': datetime.datetime(2023, 2, 10, 21, 2, 20),
	'data': 'Some Data 2'
}

'''

table.find(match, options)

Finds matches in a table

match = {
	'data': {
		'$like': 'Some Data %'
	}
}

options = {
	'fields': ['id', 'currentTime', 'data'],
	'skip': 2,
	'limit': 1
}

result = testTable.find(match, options)

'''

result [
	{
		'id': 3,
		'currentTime': datetime.datetime(2023, 2, 10, 21, 2, 20),
		'data': 'Some Data 2'
	}
]

'''


MIT License

Alexander Yermolenko • surfy.one

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Surfy.SQLite-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Surfy.SQLite-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file Surfy.SQLite-1.0.0.tar.gz.

File metadata

  • Download URL: Surfy.SQLite-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for Surfy.SQLite-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d05a6dd7cf98c039763d8c556c2aa233d16c715c9595473def8914400dd9d3d0
MD5 1307466017f901079c15c5c4726dac73
BLAKE2b-256 074e0da7c7c10f5a6717abf50da1be62175e0d152e1a6abf774757f99233a630

See more details on using hashes here.

File details

Details for the file Surfy.SQLite-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: Surfy.SQLite-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for Surfy.SQLite-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e93c3955a4c4ba212e7e737aff8447d5b2210fbbcbae438d25e008f8509a7342
MD5 d0cdcbd4ad9eeb39010b559f42ebe59d
BLAKE2b-256 0fa0fd3cc4b2704662d1cf20142b0c5e232a65c8cacf246ff03f062a4e4faee8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page