-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
132 additions
and
8 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
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ | |
""" | ||
|
||
# __version__ = "0.4.0-alpha.6" | ||
__version__ = "0.10.0" | ||
__version__ = "0.11.0-alpha.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
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,32 @@ | ||
""" | ||
Test we can read from Sqlite - this is a basic exercise of the SQL Connector | ||
""" | ||
import os | ||
import sys | ||
|
||
sys.path.insert(1, os.path.join(sys.path[0], "../..")) | ||
|
||
import opteryx | ||
|
||
from opteryx.connectors import SqlConnector | ||
|
||
|
||
def test_sqlite_storage(): | ||
opteryx.register_store( | ||
"sqlite", | ||
SqlConnector, | ||
remove_prefix=True, | ||
connection="sqlite:///testdata/sqlite/database.db", | ||
) | ||
|
||
results = opteryx.query("SELECT * FROM sqlite.planets") | ||
assert results.rowcount == 9, results.rowcount | ||
|
||
# PROCESS THE DATA IN SOME WAY | ||
results = opteryx.query("SELECT COUNT(*) FROM sqlite.planets;") | ||
assert results.rowcount == 1, results.rowcount | ||
|
||
|
||
if __name__ == "__main__": # pragma: no cover | ||
test_sqlite_storage() | ||
print("✅ okay") |
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,32 @@ | ||
""" | ||
Test we can read from Sqlite - this is a basic exercise of the SQL Connector | ||
""" | ||
import os | ||
import sys | ||
|
||
sys.path.insert(1, os.path.join(sys.path[0], "../..")) | ||
|
||
import opteryx | ||
|
||
from opteryx.connectors import SqlConnector | ||
|
||
|
||
def test_sqlalchemy(): | ||
from sqlalchemy import create_engine | ||
|
||
connection_string = "sqlite:///testdata/sqlite/database.db" | ||
engine = create_engine(connection_string) | ||
|
||
opteryx.register_store("sqlite", SqlConnector, remove_prefix=True, engine=engine) | ||
|
||
results = opteryx.query("SELECT * FROM sqlite.planets") | ||
assert results.rowcount == 9, results.rowcount | ||
|
||
# PROCESS THE DATA IN SOME WAY | ||
results = opteryx.query("SELECT COUNT(*) FROM sqlite.planets;") | ||
assert results.rowcount == 1, results.rowcount | ||
|
||
|
||
if __name__ == "__main__": # pragma: no cover | ||
test_sqlalchemy() | ||
print("✅ okay") |