mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 18:04:32 +02:00
sqlite-utils tables ... --schema option, closes #104
This commit is contained in:
parent
2b40710e9d
commit
147b52622d
3 changed files with 34 additions and 2 deletions
|
|
@ -72,6 +72,18 @@ def test_tables_counts_and_columns_csv(db_path):
|
|||
) == result.output.strip()
|
||||
|
||||
|
||||
def test_tables_schema(db_path):
|
||||
db = Database(db_path)
|
||||
with db.conn:
|
||||
db["lots"].insert_all([{"id": i, "age": i + 1} for i in range(30)])
|
||||
result = CliRunner().invoke(cli.cli, ["tables", "--schema", db_path])
|
||||
assert (
|
||||
'[{"table": "Gosh", "schema": "CREATE TABLE Gosh (c1 text, c2 text, c3 text)"},\n'
|
||||
' {"table": "Gosh2", "schema": "CREATE TABLE Gosh2 (c1 text, c2 text, c3 text)"},\n'
|
||||
' {"table": "lots", "schema": "CREATE TABLE [lots] (\\n [id] INTEGER,\\n [age] INTEGER\\n)"}]'
|
||||
) == result.output.strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"fmt,expected",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue