Delete a FieldΒΆ

Example

>>> import shutil
>>> shutil.copy("examples/fintech/database.csv.zip", "examples/fintech/data/processed/database.csv.zip")
'examples/fintech/data/processed/database.csv.zip'
>>> # Creates, configures, and runs the operator
>>> from techminer2.database.operators import CopyOperator
>>> (
...     CopyOperator()
...     #
...     # FIELDS:
...     .with_field("author_keywords")
...     .with_other_field("author_keywords_copy")
...     #
...     # DATABASE:
...     .where_root_directory_is("examples/fintech/")
...     #
...     .run()
... )
>>> # Deletes the field
>>> from techminer2.database.operators import DeleteOperator
>>> (
...     DeleteOperator()
...     .with_field("author_keywords_copy")
...     .where_root_directory_is("examples/fintech/")
...     .run()
... )
>>> # Query the database to test the operator
>>> from techminer2.database.tools import Query
>>> df = (
...     Query()
...     .with_query_expression("SELECT * FROM database LIMIT 5;")
...     .where_root_directory_is("examples/fintech/")
...     .where_database_is("main")
...     .where_record_years_range_is(None, None)
...     .where_record_citations_range_is(None, None)
...     .run()
... )
>>> print("author_keywords_copy" in df.columns)
False