Syncdb command

### Navigation

- index
- next |
- previous |
- fantastico 0.5.0-b126 documentation »
- Fantastico features »
- SDK »

# Syncdb command

Syncdb command is used to keep Fantastico projects databases updated. It is extremely easy to use it and in addition works on every operating system. In order to familiarize with components model read Component model.

class `fantastico.sdk.commands.command_syncdb.` `SdkCommandSyncDb`(args, cmd_factory, settings_facade_cls=<class 'fantastico.settings.SettingsFacade'>)

  This class provides the algorithm for synchronizing Fantastico projects database scripts with the current configured database connection. Below you can find the order in which scripts are executed:

  1. Scan and execute all activated extensions sql/module_setup.sql scripts.
  2. Scan and execute all activated extensions for sql/create_data.sql scripts.

  syncdb command first required database structure for all modules and the it populates them with necessary data. It is important to understand that rollback procedures are not currently in place and there is no way to guarantee data integrity. All components providers are responsible for writing module_setup in such a way that in case of error data is left in a consistent state.

  For possible examples of how to structure a component read Component model

      fsdk syncdb --db-command /usr/bin/mysql --comp-root samples

  It is important to understand that this command will synchronize all module_setup / create_data sql scripts for current active settings. Read more about configuring fantastico on Fantastico settings.

  `exec`(os_lib=<module 'os' from '/mnt/jenkins_ebs/continous_integration/fantastico_doc_workspace/pip-deps/lib/python3.2/os.py'>, call_cmd=<function call at 0x18a32f8>)

    This method executes module_setup.sql and create_data.sql scripts.

    Raises fantastico.sdk.sdk_exceptions.FantasticoSdkCommandError:
    | When scripts execution fails unexpectedly.

  `get_arguments`()

    This method returns support arguments for syncdb:

    1. -d –db-command path to mysql command.
    2. -p –comp-root component root folder.
  `get_help`()

    This method returns the friendly help message describing the method.