simonw / sqlite-utils

Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
Apache License 2.0
1.66k stars 111 forks source link

Add duplicate table feature #452

Closed davidleejy closed 2 years ago

davidleejy commented 2 years ago

This PR addresses a feature request raised in issue #449. Specifically this PR adds a functionality that lets users duplicate a table via:

table_new = db["my_table"].duplicate("new_table")

Test added in file tests/test_duplicate.py.

Happy to make changes to meet maintainers' feedback, if any.

codecov[bot] commented 2 years ago

Codecov Report

Merging #452 (eef350f) into main (42440d6) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #452   +/-   ##
=======================================
  Coverage   96.60%   96.61%           
=======================================
  Files           6        6           
  Lines        2534     2540    +6     
=======================================
+ Hits         2448     2454    +6     
  Misses         86       86           
Impacted Files Coverage Δ
sqlite_utils/db.py 97.53% <100.00%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 42440d6...eef350f. Read the comment docs.