Rename 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 to copy the field
>>> 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()
... )
>>> # Creates, configures, and runs the operator to rename the field
>>> from techminer2.database.operators import RenameOperator
>>> (
...     RenameOperator()
...     #
...     # FIELDS:
...     .with_field("author_keywords_copy")
...     .with_other_field("author_keywords_renamed")
...     #
...     # DATABASE:
...     .where_root_directory_is("examples/fintech/")
...     .run()
... )
>>> # Query the database to test the operator
>>> from techminer2.database.tools import Query
>>> (
...     Query()
...     .with_query_expression("SELECT author_keywords_renamed 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()
... )
                             author_keywords_renamed
0  ELABORATION_LIKELIHOOD_MODEL; FINTECH; K_PAY; ...
1  ACTOR_NETWORK_THEORY; CHINESE_TELECOM; FINTECH...
2  FINANCIAL_INCLUSION; FINANCIAL_SCENARIZATION; ...
3                 BANKING_INNOVATIONS; FINTECH; RISK
4  BEHAVIOURAL_ECONOMICS; DIGITAL_TECHNOLOGIES; F...
>>> # Deletes the field
>>> from techminer2.database.operators import DeleteOperator
>>> DeleteOperator(
...     field="author_keywords_renamed",
...     root_directory="examples/fintech/",
... ).run()