sunpy.database.split_database(source_database, destination_database, *query_string)[source]#

Queries the source database with the query string, and moves the matched entries to the destination database. When this function is called, the undo feature is disabled for both databases.

  • source_database (Database) – A SunPy Database object. This is the database on which the queries will be made.

  • destination_database (Database) – A SunPy Database object. This is the database to which the matched entries will be moved.

  • *query_string (list) – A variable number of attributes that are chained together via the boolean AND operator. The | operator may be used between attributes to express the boolean OR operator.


The function call in the following example moves those entries from database1 to database2 which have Instrument = ‘AIA’ or ‘ERNE’.

>>> from sunpy.database import Database, split_database
>>> from sunpy.database.tables import display_entries
>>> from sunpy.net import vso, attrs as a
>>> database1 = Database('sqlite:///:memory:')
>>> database2 = Database('sqlite:///:memory:')
>>> client = vso.VSOClient()  
>>> qr = client.search(a.Time('2011-05-08', '2011-05-08 00:00:05'), response_format="legacy")  
>>> database1.add_from_vso_query_result(qr)  
>>> database1, database2 = split_database(database1, database2,
...            a.Instrument.aia | a.Instrument.erne)