New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database should support relative file paths #783

Open
Cadair opened this Issue Jan 28, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@Cadair
Member

Cadair commented Jan 28, 2014

To make the database portable and support network hosted SQL databases, there should be a mechanism for storing path names relative to a base path.

i.e.

db.fetch(path='{file}') #relative path
db.fetch(path='/my/dir/{file}.fits') #absolute path

The base path could be optionally stored in the sunpyrc config and overridden when a database is created:

db = Database('sqlite:///', basepath='/my_network/share')

@ghost ghost assigned derdon Jan 28, 2014

@derdon

This comment has been minimized.

Show comment
Hide comment
@derdon

derdon Feb 9, 2014

Member

notes to self:

  • Database.fetch won't be touched
  • Database.query(Path('/abs/path')) → search absolutely
  • Database.query(Path('rel/path')) → search relative to base path
  • Database.download(…, path='/abs/path') → no new behaviour
  • Database.download(…, path='rel/path') → build an absolute path from basepath + given relative path, use it to download data via VSO. but store just the relative path in the databse.
  • DatabaseEntry.path is always an absolute path! (required to keep creating maps from database entries simple and intuitive)

Now one question: What if Database.download or Database.query is used with a relative path but there is no base path specified in the sunpyrc or via Database.__init__? Should there be some default base path or should it throw an error?

Member

derdon commented Feb 9, 2014

notes to self:

  • Database.fetch won't be touched
  • Database.query(Path('/abs/path')) → search absolutely
  • Database.query(Path('rel/path')) → search relative to base path
  • Database.download(…, path='/abs/path') → no new behaviour
  • Database.download(…, path='rel/path') → build an absolute path from basepath + given relative path, use it to download data via VSO. but store just the relative path in the databse.
  • DatabaseEntry.path is always an absolute path! (required to keep creating maps from database entries simple and intuitive)

Now one question: What if Database.download or Database.query is used with a relative path but there is no base path specified in the sunpyrc or via Database.__init__? Should there be some default base path or should it throw an error?

@Cadair Cadair added the Database label Feb 18, 2014

@Cadair

This comment has been minimized.

Show comment
Hide comment
@Cadair

Cadair Feb 19, 2014

Member

@derdon if databaseentry.path is always absolute what happens if you need to change the prefix?

Member

Cadair commented Feb 19, 2014

@derdon if databaseentry.path is always absolute what happens if you need to change the prefix?

@Cadair

This comment has been minimized.

Show comment
Hide comment
@Cadair

Cadair Feb 19, 2014

Member

It could be a property that creates an absolute path?

Member

Cadair commented Feb 19, 2014

It could be a property that creates an absolute path?

@derdon

This comment has been minimized.

Show comment
Hide comment
@derdon

derdon Feb 19, 2014

Member

Yes, I plan it to be a property. That's what I meant with my note.

Member

derdon commented Feb 19, 2014

Yes, I plan it to be a property. That's what I meant with my note.

@Cadair Cadair modified the milestones: 0.6, 0.5 Apr 24, 2014

@Cadair Cadair modified the milestones: 0.7, 0.6 Sep 1, 2014

@nabobalis nabobalis removed the In Progress label Mar 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment