You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3f04717
Browse filesBrowse the repository at this point in the historyBrowse files
In Python: :ref:`table.insert(..., replace=True) <python_api_insert_replace>` CLI reference: :ref:`sqlite-utils insert <cli_ref_insert>`
1629
+
1618
1630
.. _cli_upsert:
1619
1631
1620
1632
Upserting data
@@ -1641,6 +1653,9 @@ The command will fail if you reference columns that do not exist on the table. T
1641
1653
``upsert`` in sqlite-utils 1.x worked like ``insert ... --replace`` does in 2.x. See `issue #66 <https://github.com/simonw/sqlite-utils/issues/66>`__ for details of this change.
1642
1654
1643
1655
1656
+
.. note::
1657
+
In Python: :ref:`table.upsert() <python_api_upsert>` CLI reference: :ref:`sqlite-utils upsert <cli_ref_upsert>`
1658
+
1644
1659
.. _cli_bulk:
1645
1660
1646
1661
Executing SQL in bulk
@@ -1842,6 +1857,9 @@ You can include named parameters in your where clause and populate them using on
1842
1857
1843
1858
The ``--dry-run`` option will output a preview of the conversion against the first ten rows, without modifying the database.
1844
1859
1860
+
.. note::
1861
+
In Python: :ref:`table.convert() <python_api_convert>` CLI reference: :ref:`sqlite-utils convert <cli_ref_convert>`
1862
+
1845
1863
.. _cli_convert_import:
1846
1864
1847
1865
Importing additional modules
@@ -2140,6 +2158,9 @@ If a table with the same name already exists, you will get an error. You can cho
2140
2158
2141
2159
You can also pass ``--transform`` to transform the existing table to match the new schema. See :ref:`python_api_explicit_create` in the Python library documentation for details of how this option works.
2142
2160
2161
+
.. note::
2162
+
In Python: :ref:`table.create() <python_api_explicit_create>` CLI reference: :ref:`sqlite-utils create-table <cli_ref_create_table>`
2163
+
2143
2164
.. _cli_renaming_tables:
2144
2165
2145
2166
Renaming a table
@@ -2153,6 +2174,9 @@ Yo ucan rename a table using the ``rename-table`` command:
2153
2174
2154
2175
Pass ``--ignore`` to ignore any errors caused by the table not existing, or the new name already being in use.
2155
2176
2177
+
.. note::
2178
+
In Python: :ref:`db.rename_table() <python_api_rename_table>` CLI reference: :ref:`sqlite-utils rename-table <cli_ref_rename_table>`
2179
+
2156
2180
.. _cli_duplicate_table:
2157
2181
2158
2182
Duplicating tables
@@ -2164,6 +2188,9 @@ The ``duplicate`` command duplicates a table - creating a new table with the sam
In Python: :ref:`table.insert(..., alter=True) <python_api_add_column_alter>`
2572
+
2525
2573
.. _cli_add_foreign_key:
2526
2574
2527
2575
Adding foreign key constraints
@@ -2549,6 +2597,9 @@ Add ``--ignore`` to ignore an existing foreign key (as opposed to returning an e
2549
2597
2550
2598
See :ref:`python_api_add_foreign_key` in the Python API documentation for further details, including how the automatic table guessing mechanism works.
2551
2599
2600
+
.. note::
2601
+
In Python: :ref:`table.add_foreign_key() <python_api_add_foreign_key>` CLI reference: :ref:`sqlite-utils add-foreign-key <cli_ref_add_foreign_key>`
2602
+
2552
2603
.. _cli_add_foreign_keys:
2553
2604
2554
2605
Adding multiple foreign keys at once
@@ -2564,6 +2615,9 @@ Adding a foreign key requires a ``VACUUM``. On large databases this can be an ex
2564
2615
2565
2616
When you are using this command each foreign key needs to be defined in full, as four arguments - the table, column, other table and other column.
2566
2617
2618
+
.. note::
2619
+
In Python: :ref:`db.add_foreign_keys() <python_api_add_foreign_keys>` CLI reference: :ref:`sqlite-utils add-foreign-keys <cli_ref_add_foreign_keys>`
2620
+
2567
2621
.. _cli_index_foreign_keys:
2568
2622
2569
2623
Adding indexes for all foreign keys
@@ -2575,6 +2629,9 @@ If you want to ensure that every foreign key column in your database has a corre
2575
2629
2576
2630
sqlite-utils index-foreign-keys books.db
2577
2631
2632
+
.. note::
2633
+
In Python: :ref:`db.index_foreign_keys() <python_api_index_foreign_keys>` CLI reference: :ref:`sqlite-utils index-foreign-keys <cli_ref_index_foreign_keys>`
2634
+
2578
2635
.. _cli_defaults_not_null:
2579
2636
2580
2637
Setting defaults and not null constraints
@@ -2590,6 +2647,9 @@ You can use the ``--not-null`` and ``--default`` options (to both ``insert`` and
2590
2647
--default age 2 \
2591
2648
--default score 5
2592
2649
2650
+
.. note::
2651
+
In Python: :ref:`not_null= and defaults= arguments <python_api_defaults_not_null>`
2652
+
2593
2653
.. _cli_create_index:
2594
2654
2595
2655
Creating indexes
@@ -2621,6 +2681,9 @@ If your column names are already prefixed with a hyphen you'll need to manually
2621
2681
2622
2682
Add the ``--analyze`` option to run ``ANALYZE`` against the index after it has been created.
2623
2683
2684
+
.. note::
2685
+
In Python: :ref:`table.create_index() <python_api_create_index>` CLI reference: :ref:`sqlite-utils create-index <cli_ref_create_index>`
2686
+
2624
2687
.. _cli_drop_index:
2625
2688
2626
2689
Dropping indexes
@@ -2634,6 +2697,9 @@ You can drop an index from an existing table using the ``drop-index`` command:
2634
2697
2635
2698
Use ``--ignore`` to ignore the error if the index does not exist on that table.
2636
2699
2700
+
.. note::
2701
+
In Python: :ref:`table.drop_index() <python_api_create_index>` CLI reference: :ref:`sqlite-utils drop-index <cli_ref_drop_index>`
2702
+
2637
2703
.. _cli_fts:
2638
2704
2639
2705
Configuring full-text search
@@ -2687,6 +2753,9 @@ You can rebuild every FTS table by running ``rebuild-fts`` without passing any t
2687
2753
2688
2754
sqlite-utils rebuild-fts mydb.db
2689
2755
2756
+
.. note::
2757
+
In Python: :ref:`table.enable_fts() <python_api_fts_enable>` CLI reference: :ref:`sqlite-utils enable-fts <cli_ref_enable_fts>`
2758
+
2690
2759
.. _cli_search:
2691
2760
2692
2761
Executing searches
@@ -2743,6 +2812,9 @@ Use the ``--sql`` option to output the SQL that would be executed, rather than r
2743
2812
order by
2744
2813
"documents_fts".rank
2745
2814
2815
+
.. note::
2816
+
In Python: :ref:`table.search() <python_api_fts_search>` CLI reference: :ref:`sqlite-utils search <cli_ref_search>`
2817
+
2746
2818
.. _cli_enable_counts:
2747
2819
2748
2820
Enabling cached counts
@@ -2766,6 +2838,9 @@ If the ``_counts`` table ever becomes out-of-sync with the actual table counts y
2766
2838
2767
2839
sqlite-utils reset-counts mydb.db
2768
2840
2841
+
.. note::
2842
+
In Python: :ref:`table.enable_counts() <python_api_cached_table_counts>` CLI reference: :ref:`sqlite-utils enable-counts <cli_ref_enable_counts>`
2843
+
2769
2844
.. _cli_analyze:
2770
2845
2771
2846
Optimizing index usage with ANALYZE
@@ -2789,6 +2864,9 @@ You can run it against specific tables, or against specific named indexes, by pa
2789
2864
2790
2865
You can also run ``ANALYZE`` as part of another command using the ``--analyze`` option. This is supported by the ``create-index``, ``insert`` and ``upsert`` commands.
2791
2866
2867
+
.. note::
2868
+
In Python: :ref:`db.analyze() <python_api_analyze>` CLI reference: :ref:`sqlite-utils analyze <cli_ref_analyze>`
2869
+
2792
2870
.. _cli_vacuum:
2793
2871
2794
2872
Vacuum
@@ -2800,6 +2878,9 @@ You can run VACUUM to optimize your database like so:
2800
2878
2801
2879
sqlite-utils vacuum mydb.db
2802
2880
2881
+
.. note::
2882
+
In Python: :ref:`db.vacuum() <python_api_vacuum>` CLI reference: :ref:`sqlite-utils vacuum <cli_ref_vacuum>`
2883
+
2803
2884
.. _cli_optimize:
2804
2885
2805
2886
Optimize
@@ -2823,6 +2904,9 @@ To optimize specific tables rather than every FTS table, pass those tables as ex
2823
2904
2824
2905
sqlite-utils optimize mydb.db table_1 table_2
2825
2906
2907
+
.. note::
2908
+
In Python: :ref:`table.optimize() <python_api_fts_optimize>` CLI reference: :ref:`sqlite-utils optimize <cli_ref_optimize>`
2909
+
2826
2910
.. _cli_wal:
2827
2911
2828
2912
WAL mode
@@ -2842,6 +2926,9 @@ You can disable WAL mode using ``disable-wal``:
2842
2926
2843
2927
Both of these commands accept one or more database files as arguments.
2844
2928
2929
+
.. note::
2930
+
In Python: :ref:`db.enable_wal() and db.disable_wal() <python_api_wal>` CLI reference: :ref:`sqlite-utils enable-wal <cli_ref_enable_wal>`
2931
+
2845
2932
.. _cli_dump:
2846
2933
2847
2934
Dumping the database to SQL
@@ -2857,6 +2944,9 @@ The ``dump`` command outputs a SQL dump of the schema and full contents of the s
2857
2944
...
2858
2945
COMMIT;
2859
2946
2947
+
.. note::
2948
+
In Python: :ref:`db.iterdump() <python_api_itedump>` CLI reference: :ref:`sqlite-utils dump <cli_ref_dump>`
2949
+
2860
2950
.. _cli_load_extension:
2861
2951
2862
2952
Loading SQLite extensions
@@ -2904,6 +2994,9 @@ Eight (case-insensitive) types are allowed:
2904
2994
* GEOMETRYCOLLECTION
2905
2995
* GEOMETRY
2906
2996
2997
+
.. note::
2998
+
In Python: :ref:`table.add_geometry_column() <python_api_gis_add_geometry_column>` CLI reference: :ref:`sqlite-utils add-geometry-column <cli_ref_add_geometry_column>`
2999
+
2907
3000
.. _cli_spatialite_indexes:
2908
3001
2909
3002
Adding spatial indexes
@@ -2917,6 +3010,9 @@ Once you have a geometry column, you can speed up bounding box queries by adding
2917
3010
2918
3011
See this `SpatiaLite Cookbook recipe <http://www.gaia-gis.it/gaia-sins/spatialite-cookbook-5/cookbook_topics.03.html#topic_Wonderful_RTree_Spatial_Index>`__ for examples of how to use a spatial index.
2919
3012
3013
+
.. note::
3014
+
In Python: :ref:`table.create_spatial_index() <python_api_gis_create_spatial_index>` CLI reference: :ref:`sqlite-utils create-spatial-index <cli_ref_create_spatial_index>`
0 commit comments