Let's remove the need for writing strings and formatting them. We need a more flexible API for building queries. Advantages:
Backend data warehouse is now pluggable (in the future we ca opt to use BigQuery OR a PostGIS server).
SQL queries are now in a Python-ic DSL. Much better than writing string-formatted queries.
PR Requirements
[x] Port the string-formatted query into an SQLAlchemy Query. The user should still be able to supply the fclass, source_table (OSM) and BigQuery options if possible
[x] No need to pass the client (?), we just need to pass the database URI.
[x] If a table is uploaded into the BQ Dataset, ensure that there is an expiration date (previously, we're creating a new table per call, which is not cost-efficient).
I suggest creating a query() method and have it an abstract class method. Must raise a NotImplementedError for geomancer.base.Spell. The geomancer.base.Spell.cast() method should ideally be inherited (all subclasses should just call super())
Ideal Scenario: when implementing a new Spell (i.e., subclassing the Spell base), I don't need to think of implementing cast anymore (in fact, this whole thing should be inherited, super()). Instead, I should just implement the query() method using the SQLAlchemy dialect.
Let's remove the need for writing strings and formatting them. We need a more flexible API for building queries. Advantages:
PR Requirements
fclass
,source_table
(OSM) and BigQuery options if possibleI suggest creating a
query() method
and have it an abstract class method. Must raise aNotImplementedError
forgeomancer.base.Spell
. Thegeomancer.base.Spell.cast()
method should ideally be inherited (all subclasses should just callsuper()
)Ideal Scenario: when implementing a new
Spell
(i.e., subclassing theSpell
base), I don't need to think of implementingcast
anymore (in fact, this whole thing should be inherited,super()
). Instead, I should just implement thequery()
method using the SQLAlchemy dialect.