This repository has been archived by the owner on Nov 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add post insert step and add many validations and tests
* Use make_url when creating new engine * Add column type checking, fix bugs uncovered by new changes * Improve schema alteration logic and add unit tests * Bump requirements * Add escaping to default value in alter table * Lint * Add more detailed column value testing * Fix isort lint * Add post_insert step * Add unit test for undefined length string * Add inits to test directories to trigger tests with nose
- Loading branch information
Showing
14 changed files
with
219 additions
and
29 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
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
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
Empty file.
Empty file.
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,35 @@ | ||
from datetime import date | ||
|
||
from sqlalchemy.schema import Column | ||
from sqlalchemy.types import Date, String | ||
|
||
from sqltask.base.engine import EngineContext | ||
from sqltask.base.table import BaseTableContext | ||
|
||
|
||
def get_table_context() -> BaseTableContext: | ||
engine_context = EngineContext("source", "sqlite://") | ||
return BaseTableContext( | ||
name="table", | ||
engine_context=engine_context, | ||
columns=[ | ||
Column("report_date", Date, primary_key=True), | ||
Column("customer_name", String(10), comment="Name", primary_key=True), | ||
Column("birthdate", Date, comment="Birthday", nullable=True), | ||
], | ||
comment="The table", | ||
batch_params={"report_date": date(2019, 12, 31)}, | ||
) | ||
|
||
|
||
def populate_dummy_rows(table_context: BaseTableContext) -> None: | ||
rows = ( | ||
(date(2019, 12, 31), "Jill", date(2009, 3, 31)), | ||
(date(2019, 12, 31), "Jack", date(1999, 2, 28)) | ||
) | ||
for in_row in rows: | ||
row = table_context.get_new_row() | ||
row["report_date"] = in_row[0] | ||
row["customer_name"] = in_row[1] | ||
row["birthdate"] = in_row[2] | ||
row.append() |
Empty file.
Oops, something went wrong.