-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,372 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
permissions: | ||
contents: write | ||
pages: write | ||
|
||
on: | ||
push: | ||
branches: [ "main", "master" ] | ||
workflow_dispatch: | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: [uses: fastai/workflows/quarto-ghp@master] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: CI | ||
on: [workflow_dispatch, pull_request, push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: [uses: fastai/workflows/nbdev-ci@master] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include settings.ini | ||
include LICENSE | ||
include CONTRIBUTING.md | ||
include README.md | ||
recursive-exclude * __pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# fastsqlite | ||
A bit of extra usability for sqlite | ||
# fastlite | ||
|
||
|
||
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> | ||
|
||
This file will become your README and also the index of your | ||
documentation. | ||
|
||
## Install | ||
|
||
``` sh | ||
pip install fastlite | ||
``` | ||
|
||
## How to use | ||
|
||
Fill me in please! Don’t forget code examples: | ||
|
||
``` python | ||
1+1 | ||
``` | ||
|
||
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Autogenerated by nbdev | ||
|
||
d = { 'settings': { 'branch': 'main', | ||
'doc_baseurl': '/fastlite', | ||
'doc_host': 'https://AnswerDotAI.github.io', | ||
'git_url': 'https://github.com/AnswerDotAI/fastlite', | ||
'lib_path': 'fastlite'}, | ||
'syms': { 'fastlite.core': { 'fastlite.core.Database.t': ('core.html#database.t', 'fastlite/core.py'), | ||
'fastlite.core.Table.__str__': ('core.html#table.__str__', 'fastlite/core.py'), | ||
'fastlite.core.Table.c': ('core.html#table.c', 'fastlite/core.py'), | ||
'fastlite.core.View.__str__': ('core.html#view.__str__', 'fastlite/core.py'), | ||
'fastlite.core.View.c': ('core.html#view.c', 'fastlite/core.py'), | ||
'fastlite.core._Col': ('core.html#_col', 'fastlite/core.py'), | ||
'fastlite.core._Col.__init__': ('core.html#_col.__init__', 'fastlite/core.py'), | ||
'fastlite.core._Col.__repr__': ('core.html#_col.__repr__', 'fastlite/core.py'), | ||
'fastlite.core._Col.__str__': ('core.html#_col.__str__', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter': ('core.html#_colsgetter', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter.__call__': ('core.html#_colsgetter.__call__', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter.__dir__': ('core.html#_colsgetter.__dir__', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter.__getattr__': ('core.html#_colsgetter.__getattr__', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter.__init__': ('core.html#_colsgetter.__init__', 'fastlite/core.py'), | ||
'fastlite.core._ColsGetter.__repr__': ('core.html#_colsgetter.__repr__', 'fastlite/core.py'), | ||
'fastlite.core._Getter': ('core.html#_getter', 'fastlite/core.py'), | ||
'fastlite.core._Getter.__getattr__': ('core.html#_getter.__getattr__', 'fastlite/core.py'), | ||
'fastlite.core._Getter.__init__': ('core.html#_getter.__init__', 'fastlite/core.py'), | ||
'fastlite.core._Getter.__repr__': ('core.html#_getter.__repr__', 'fastlite/core.py'), | ||
'fastlite.core._TablesGetter': ('core.html#_tablesgetter', 'fastlite/core.py'), | ||
'fastlite.core._TablesGetter.__dir__': ('core.html#_tablesgetter.__dir__', 'fastlite/core.py')}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = [] | ||
|
||
# %% ../nbs/00_core.ipynb 3 | ||
from fastcore.utils import * | ||
from fastcore.xml import highlight | ||
from fastcore.xtras import hl_md | ||
|
||
from sqlite_utils import Database | ||
from sqlite_utils.db import Table, View | ||
|
||
# %% ../nbs/00_core.ipynb 6 | ||
class _Getter: | ||
"Abstract class with dynamic attributes providing access to DB objects" | ||
def __init__(self, db): self.db = db | ||
# NB: Define `__dir__` in subclass to get list of objects | ||
def __repr__(self): return ", ".join(dir(self)) | ||
def __getattr__(self, k): | ||
if k[0]=='_': raise AttributeError | ||
return self.db[k] | ||
|
||
class _TablesGetter(_Getter): | ||
def __dir__(self): return self.db.table_names() | ||
|
||
@patch(as_prop=True) | ||
def t(self:Database): return _TablesGetter(self) | ||
|
||
# %% ../nbs/00_core.ipynb 9 | ||
class _Col: | ||
def __init__(self, t, c): self.t,self.c = t,c | ||
def __str__(self): return f'"{self.t}"."{self.c}"' | ||
def __repr__(self): return f'{self.c}' | ||
|
||
class _ColsGetter: | ||
def __init__(self, tbl): self.tbl = tbl | ||
def __dir__(self): return map(repr, self()) | ||
def __call__(self): return [_Col(self.tbl.name,o.name) for o in self.tbl.columns] | ||
def __repr__(self): return ", ".join(dir(self)) | ||
|
||
def __getattr__(self, k): | ||
if k[0]=='_': raise AttributeError | ||
return _Col(self.tbl.name, k) | ||
|
||
@patch(as_prop=True) | ||
def c(self:Table): return _ColsGetter(self) | ||
|
||
@patch(as_prop=True) | ||
def c(self:View): return _ColsGetter(self) | ||
|
||
# %% ../nbs/00_core.ipynb 14 | ||
@patch | ||
def __str__(self:Table): return f'"{self.name}"' | ||
|
||
@patch | ||
def __str__(self:View): return f'"{self.name}"' |
Oops, something went wrong.