Skip to content
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

AxClient SQL initialization error #560

Closed
rzc331 opened this issue Apr 16, 2021 · 2 comments
Closed

AxClient SQL initialization error #560

rzc331 opened this issue Apr 16, 2021 · 2 comments
Assignees
Labels
fixready Fix has landed on master.

Comments

@rzc331
Copy link

rzc331 commented Apr 16, 2021

Hi, I am trying to follow these steps on this tutorial

from ax.storage.sqa_store.structs import DBSettings

# URL is of the form "dialect+driver://username:password@host:port/database".
db_settings = DBSettings(url="postgresql+psycopg2://sarah:c82i94d@ocalhost:5432/foobar")
# Instead of URL, can provide a `creator function`; can specify custom encoders/decoders if necessary.
new_ax = AxClient(db_settings=db_settings)

While getting these error:

TypeError                                 Traceback (most recent call last)

<ipython-input-15-7fbaa4d2b122> in <module>
      1 # sql settings
      2 db_settings = DBSettings(url='postgresql+psycopg2://li:***@***:5432/test')
----> 3 ax_client = AxClient(enforce_sequential_optimization=False, db_settings=db_settings)
      4 ax_client.create_experiment(name='test')
      5 init_notebook_plotting()

~\miniconda3\envs\ax\lib\site-packages\ax\service\ax_client.py in __init__(self, generation_strategy, db_settings, enforce_sequential_optimization, random_seed, verbose_logging, suppress_storage_errors)
    132         suppress_storage_errors: bool = False,
    133     ) -> None:
--> 134         super().__init__(db_settings=db_settings)
    135         if not verbose_logging:
    136             logger.setLevel(logging.WARNING)  # pragma: no cover

~\miniconda3\envs\ax\lib\site-packages\ax\service\utils\with_db_settings_base.py in __init__(self, db_settings, logging_level)
     67         self._db_settings = db_settings
     68         if self.db_settings_set:
---> 69             init_engine_and_session_factory(
     70                 creator=self.db_settings.creator, url=self.db_settings.url
     71             )

~\miniconda3\envs\ax\lib\site-packages\ax\storage\sqa_store\db.py in init_engine_and_session_factory(url, creator, echo, force_init, **kwargs)
    338             return  # pragma: no cover
    339     if url is not None:
--> 340         engine = create_mysql_engine_from_url(url=url, echo=echo, **kwargs)
    341     elif creator is not None:
    342         engine = create_mysql_engine_from_creator(creator=creator, echo=echo, **kwargs)

~\miniconda3\envs\ax\lib\site-packages\ax\storage\sqa_store\db.py in create_mysql_engine_from_url(url, echo, pool_recycle, **kwargs)
    278 
    279     """
--> 280     return create_engine(
    281         name_or_url=url, pool_recycle=pool_recycle, echo=echo, **kwargs
    282     )

TypeError: create_engine() missing 1 required positional argument: 'url'

I can connect the SQL server with pgAdmin with exactly the same info.

I'd appreciate it if anyone could advice on this.

Thanks in advance!

@ldworkin
Copy link
Contributor

Hi @rzc331 ! This has been fixed in cb9112b. You can either patch that commit locally, or wait until our next release, which should be within the next week or so.

@ldworkin ldworkin self-assigned this Apr 16, 2021
@ldworkin ldworkin added the fixready Fix has landed on master. label Apr 16, 2021
@rzc331
Copy link
Author

rzc331 commented Apr 16, 2021

It works! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixready Fix has landed on master.
Projects
None yet
Development

No branches or pull requests

2 participants